-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change base module ModuleDependency -> Dependency (#1)
- Loading branch information
Showing
19 changed files
with
6,876 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.github | ||
.vscode | ||
.yarn | ||
test | ||
.yarnrc.yml | ||
.pnp.js | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"recommendations": ["arcanis.vscode-zipfs", "esbenp.prettier-vscode"] | ||
"recommendations": [ | ||
"arcanis.vscode-zipfs", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"name": "Test", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeExecutable": "yarn", | ||
"runtimeArgs": ["jest"] | ||
} | ||
] | ||
} |
8 changes: 4 additions & 4 deletions
8
.yarn/releases/yarn-2.4.0.cjs → .yarn/releases/yarn-2.4.1.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "typescript", | ||
"version": "4.1.5-pnpify", | ||
"version": "4.2.4-pnpify", | ||
"main": "./lib/typescript.js", | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
yarnPath: .yarn/releases/yarn-2.4.0.cjs | ||
yarnPath: .yarn/releases/yarn-2.4.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
/** | ||
* @copyright 2021-present Kriasoft (https://git.io/JtoKE) | ||
* | ||
* @typedef {import("webpack").Compiler} Compiler | ||
* @typedef {import("webpack").javascript.JavascriptParser} JavascriptParser | ||
*/ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
const path = require("path"); | ||
const webpack = require("webpack"); | ||
const ImportDependency = require("./ImportDependency"); | ||
|
||
/** | ||
* Excludes dynamically imported dependencies from the output bundle. | ||
* | ||
* @typedef {import("webpack").Compiler} Compiler | ||
* @typedef {import("webpack").javascript.JavascriptParser} JavascriptParser | ||
*/ | ||
class IgnoreAsyncImportsPlugin { | ||
/** | ||
|
@@ -67,7 +66,7 @@ class IgnoreAsyncImportsPlugin { | |
const dep = new ImportDependency(expr.source.value, expr.range); | ||
dep.loc = expr.loc; | ||
parser.state.module.addDependency(dep); | ||
return true; | ||
return false; | ||
}); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Florent Cailhol @ooflorent | ||
*/ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
"use strict"; | ||
|
||
const InitFragment = require("webpack/lib/InitFragment"); | ||
const ModuleDependency = require("webpack/lib/dependencies/ModuleDependency"); | ||
const Dependency = require("webpack/lib/Dependency"); | ||
const DependencyTemplate = require("webpack/lib/DependencyTemplate"); | ||
|
||
/** @typedef {import("webpack").sources.ReplaceSource} ReplaceSource */ | ||
/** @typedef {import("webpack").ChunkGraph} ChunkGraph */ | ||
/** @typedef {import("webpack").Dependency} Dependency */ | ||
/** @typedef {import("webpack").Dependency.UpdateHashContext} UpdateHashContext */ | ||
/** @typedef {import("webpack").util.Hash} Hash */ | ||
|
||
class ImportDependency extends ModuleDependency { | ||
class ImportDependency extends Dependency { | ||
constructor(request, range) { | ||
super(request); | ||
super(); | ||
this.request = request; | ||
this.range = range; | ||
} | ||
|
||
|
@@ -41,21 +41,19 @@ class ImportDependency extends ModuleDependency { | |
serialize(context) { | ||
const { write } = context; | ||
write(this.request); | ||
write(this.userRequest); | ||
write(this.range); | ||
super.serialize(context); | ||
} | ||
|
||
deserialize(context) { | ||
const { read } = context; | ||
this.request = read(); | ||
this.userRequest = read(); | ||
this.range = read(); | ||
super.deserialize(context); | ||
} | ||
} | ||
|
||
class ImportDependencyTemplate extends ModuleDependency.Template { | ||
class ImportDependencyTemplate extends DependencyTemplate { | ||
/** | ||
* @param {Dependency} dependency the dependency for which the template should be applied | ||
* @param {ReplaceSource} source the current replace source which can be modified | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/** | ||
* @copyright 2021-present Kriasoft (https://git.io/JtoKE) | ||
*/ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
const IgnoreAsyncImportsPlugin = require("./IgnoreAsyncImportsPlugin"); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ var __webpack_modules__ = ({ | ||
|
||
/***/ 50: | ||
/***/ ((module) => { | ||
|
||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
module.exports = async function () { | ||
const module = await Promise.resolve({}); | ||
console.log(module); | ||
}; | ||
|
||
|
||
/***/ }) | ||
|
||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module is referenced by other modules so it can't be inlined | ||
/******/ var __webpack_exports__ = __webpack_require__(50); | ||
/******/ | ||
/******/ })() | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
module.exports = "external"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
module.exports = async function () { | ||
const module = await import("./app.chunk"); | ||
console.log(module); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
const { readFileSync } = require("fs"); | ||
const { webpack } = require("webpack"); | ||
const config = require("./webpack.config"); | ||
|
||
test("bundle", function (done) { | ||
const compiler = webpack(config, function (err, stats) { | ||
expect(err).toBeNull(); | ||
expect(stats.compilation.errors).toMatchInlineSnapshot(`Array []`); | ||
|
||
const bundle = readFileSync("./test/app.bundle.js", "utf-8"); | ||
expect(bundle.includes("external")).toBe(false); | ||
expect(bundle.includes("Promise.resolve({})")).toBe(true); | ||
|
||
done(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* SPDX-FileCopyrightText: 2021-present Kriasoft <[email protected]> */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
const { IgnoreAsyncImportsPlugin } = require(".."); | ||
|
||
module.exports = { | ||
entry: { | ||
main: "./app.main", | ||
}, | ||
|
||
context: __dirname, | ||
|
||
output: { | ||
path: __dirname, | ||
filename: "app.bundle.js", | ||
chunkFilename: "app.bundle.[name].js", | ||
}, | ||
|
||
optimization: { | ||
minimize: false, | ||
}, | ||
|
||
plugins: [new IgnoreAsyncImportsPlugin()], | ||
}; |
Oops, something went wrong.