@rushstack/webpack-preserve-dynamic-require-plugin 0.11.3 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/index.test.js.map +1 -1
- package/package.json +2 -3
package/dist/tsdoc-metadata.json
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC;;GAEG;AACH,qBAAa,mCAAmC;IACvC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI;CAwB/C"}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
|
+
// See LICENSE in the project root for license information.
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
5
|
exports.PreserveDynamicRequireWebpackPlugin = void 0;
|
|
4
6
|
const PLUGIN_NAME = 'PreserveDynamicRequireWebpackPlugin';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,MAAM,WAAW,GAA0C,qCAAqC,CAAC;AAEjG;;GAEG;AACH,MAAa,mCAAmC;IACvC,KAAK,CAAC,QAA0B;QACrC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,WAAgC,EAAE,EAAE;YACnF,SAAS,mBAAmB,CAC1B,KAAsE;gBAEtE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;gBAC/B,KAAK,IAAI,CAAC,GAAW,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;oBACzD,MAAM,GAAG,GAAuB,YAAY,CAAC,CAAC,CAAC,CAAC;oBAChD,wCAAwC;oBACxC,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,kCAAkC,EAAE;wBAC/D,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;qBAC3B;iBACF;gBAED,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;oBAChC,mBAAmB,CAAC,KAAK,CAAC,CAAC;iBAC5B;YACH,CAAC;YAED,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAmB,EAAE,EAAE;gBACvE,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,kFAyBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as webpack from 'webpack';\n\nconst PLUGIN_NAME: 'PreserveDynamicRequireWebpackPlugin' = 'PreserveDynamicRequireWebpackPlugin';\n\n/**\n * @public\n */\nexport class PreserveDynamicRequireWebpackPlugin {\n public apply(compiler: webpack.Compiler): void {\n compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation: webpack.Compilation) => {\n function processDependencies(\n block: Pick<webpack.AsyncDependenciesBlock, 'dependencies' | 'blocks'>\n ): void {\n const { dependencies } = block;\n for (let i: number = dependencies.length - 1; i >= 0; i--) {\n const dep: webpack.Dependency = dependencies[i];\n // Disable processing of dynamic require\n if (dep.constructor.name === 'CommonJsRequireContextDependency') {\n dependencies.splice(i, 1);\n }\n }\n\n for (const child of block.blocks) {\n processDependencies(child);\n }\n }\n\n compilation.hooks.succeedModule.tap(PLUGIN_NAME, (mod: webpack.Module) => {\n processDependencies(mod);\n });\n });\n }\n}\n"]}
|
package/lib/index.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,IAAI,CAAC,eAAe,EAAE,CAAC;AACvB,sDAA8B;AAE9B,mCAA8D;AAE9D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAErB,QAAQ,CAAC,2CAAmC,CAAC,IAAI,EAAE,GAAG,EAAE;IACtD,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,OAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,iCAAiC,CAAC,CAAC;QAE3D,MAAM,QAAQ,GAAqB,IAAA,iBAAO,EAAC;YACzC,KAAK,EAAE;gBACL,IAAI,EAAE,UAAU;aACjB;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,WAAW;aACtB;YACD,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,CAAC,IAAI,2CAAmC,EAAE,CAAC;SACrD,CAAC,CAAC;QAEH,MAAM,OAAO,GAAoC;YAC/C,QAAQ,CAAC,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I,GAAG,QAAQ,CAAC;gBACpB,EAAE,CAAC,GAAG,CAAC,CAAC;YACV,CAAC;YACD,SAAS,CAAC,IAAY,EAAE,OAAe,EAAE,EAAyC;gBAChF,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,EAAE,EAAE,CAAC;YACP,CAAC;SAC6C,CAAC;QAEjD,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC;QACnC,QAAQ,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QAErC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAmB,EAAE,MAA4B,EAAE,EAAE,CAC5E,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAkB,EAAE,EAAE;YAClC,IAAI,GAAG,EAAE;gBACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;aACpB;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\njest.disableAutomock();\nimport webpack from 'webpack';\n\nimport { PreserveDynamicRequireWebpackPlugin } from './index';\n\njest.setTimeout(1e9);\n\ndescribe(PreserveDynamicRequireWebpackPlugin.name, () => {\n it('Preserves dynamic require usage', async () => {\n const sources: Map<string, string> = new Map();\n sources.set('/package.json', JSON.stringify({}));\n sources.set('/file.js', 'require(process.env.SOME_PATH);');\n\n const compiler: webpack.Compiler = webpack({\n entry: {\n main: '/file.js'\n },\n output: {\n path: '/release',\n filename: '[name].js'\n },\n context: '/',\n mode: 'none',\n plugins: [new PreserveDynamicRequireWebpackPlugin()]\n });\n\n const inputFs: typeof compiler.inputFileSystem = {\n readFile(path: string, cb: (err?: NodeJS.ErrnoException | undefined, content?: string) => void): void {\n cb(undefined, sources.get(path));\n },\n readdir(path: string, cb: (err?: NodeJS.ErrnoException | undefined, files?: string[]) => void): void {\n cb(\n undefined,\n Array.from(sources.keys(), (key: string) => key.slice(1))\n );\n },\n readlink(path: string, cb: (err?: NodeJS.ErrnoException | undefined, dest?: string) => void): void {\n cb();\n },\n stat(path: string, cb: (err?: NodeJS.ErrnoException, stat?: unknown) => void): void {\n if (sources.has(path)) {\n return cb(undefined, {\n isFile() {\n return true;\n },\n isDirectory() {\n return false;\n }\n });\n } else if (path === '/') {\n return cb(undefined, {\n isFile() {\n return false;\n },\n isDirectory() {\n return true;\n }\n });\n }\n cb(new Error(`Unexpected stat call for ${path}`));\n }\n } as unknown as typeof compiler.inputFileSystem;\n\n const results: Map<string, string> = new Map();\n\n const outputFs: typeof compiler.outputFileSystem = {\n mkdir(path: string, cb: (err?: NodeJS.ErrnoException) => void): void {\n cb();\n },\n stat(path: string, cb: (err?: NodeJS.ErrnoException) => void): void {\n const err: NodeJS.ErrnoException = new Error(`No such file`);\n err.code = 'ENOENT';\n cb(err);\n },\n writeFile(path: string, content: Buffer, cb: (err?: NodeJS.ErrnoException) => void): void {\n results.set(path, content.toString('utf8'));\n cb();\n }\n } as unknown as typeof compiler.outputFileSystem;\n\n compiler.inputFileSystem = inputFs;\n compiler.outputFileSystem = outputFs;\n\n await new Promise<void>((resolve: () => void, reject: (err: Error) => void) =>\n compiler.run((err?: Error | null) => {\n if (err) {\n return reject(err);\n }\n resolve();\n })\n );\n\n expect(results).toMatchSnapshot();\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/webpack-preserve-dynamic-require-plugin",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "This plugin tells webpack to leave dynamic calls to \"require\" as-is instead of trying to bundle them.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "dist/webpack-preserve-dynamic-require-plugin.d.ts",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"webpack": "~5.82.1",
|
|
18
|
-
"@rushstack/
|
|
19
|
-
"@rushstack/heft": "0.61.1",
|
|
18
|
+
"@rushstack/heft": "0.61.3",
|
|
20
19
|
"local-node-rig": "1.0.0"
|
|
21
20
|
},
|
|
22
21
|
"sideEffects": false,
|