@rushstack/webpack-preserve-dynamic-require-plugin 0.11.125 → 0.12.1

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/CHANGELOG.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@rushstack/webpack-preserve-dynamic-require-plugin",
3
3
  "entries": [
4
+ {
5
+ "version": "0.12.1",
6
+ "tag": "@rushstack/webpack-preserve-dynamic-require-plugin_v0.12.1",
7
+ "date": "Thu, 19 Feb 2026 01:30:06 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Add missing LICENSE file to package."
12
+ }
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "version": "0.12.0",
18
+ "tag": "@rushstack/webpack-preserve-dynamic-require-plugin_v0.12.0",
19
+ "date": "Thu, 19 Feb 2026 00:04:53 GMT",
20
+ "comments": {
21
+ "minor": [
22
+ {
23
+ "comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
24
+ }
25
+ ],
26
+ "dependency": [
27
+ {
28
+ "comment": "Updating dependency \"@rushstack/heft\" to `1.2.0`"
29
+ }
30
+ ]
31
+ }
32
+ },
4
33
  {
5
34
  "version": "0.11.125",
6
35
  "tag": "@rushstack/webpack-preserve-dynamic-require-plugin_v0.11.125",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @rushstack/webpack-preserve-dynamic-require-plugin
2
2
 
3
- This log was last generated on Sat, 07 Feb 2026 01:13:26 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 19 Feb 2026 01:30:06 GMT and should not be manually modified.
4
+
5
+ ## 0.12.1
6
+ Thu, 19 Feb 2026 01:30:06 GMT
7
+
8
+ ### Patches
9
+
10
+ - Add missing LICENSE file to package.
11
+
12
+ ## 0.12.0
13
+ Thu, 19 Feb 2026 00:04:53 GMT
14
+
15
+ ### Minor changes
16
+
17
+ - Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
4
18
 
5
19
  ## 0.11.125
6
20
  Sat, 07 Feb 2026 01:13:26 GMT
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ @rushstack/webpack-preserve-dynamic-require-plugin
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.56.2"
8
+ "packageVersion": "7.57.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ const PLUGIN_NAME = 'PreserveDynamicRequireWebpackPlugin';
4
+ /**
5
+ * @public
6
+ */
7
+ export class PreserveDynamicRequireWebpackPlugin {
8
+ apply(compiler) {
9
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
10
+ function processDependencies(block) {
11
+ const { dependencies } = block;
12
+ for (let i = dependencies.length - 1; i >= 0; i--) {
13
+ const dep = dependencies[i];
14
+ // Disable processing of dynamic require
15
+ if (dep.constructor.name === 'CommonJsRequireContextDependency') {
16
+ dependencies.splice(i, 1);
17
+ }
18
+ }
19
+ for (const child of block.blocks) {
20
+ processDependencies(child);
21
+ }
22
+ }
23
+ compilation.hooks.succeedModule.tap(PLUGIN_NAME, (mod) => {
24
+ processDependencies(mod);
25
+ });
26
+ });
27
+ }
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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,MAAM,OAAO,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,CAAC;oBAC1D,MAAM,GAAG,GAAuB,YAAY,CAAC,CAAC,CAAC,CAAC;oBAChD,wCAAwC;oBACxC,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,kCAAkC,EAAE,CAAC;wBAChE,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC5B,CAAC;gBACH,CAAC;gBAED,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBAC7B,CAAC;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","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"]}
@@ -0,0 +1 @@
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,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,mCAAmC,EAAE,MAAM,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,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;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,9 +1,30 @@
1
1
  {
2
2
  "name": "@rushstack/webpack-preserve-dynamic-require-plugin",
3
- "version": "0.11.125",
3
+ "version": "0.12.1",
4
4
  "description": "This plugin tells webpack to leave dynamic calls to \"require\" as-is instead of trying to bundle them.",
5
- "main": "lib/index.js",
6
- "typings": "dist/webpack-preserve-dynamic-require-plugin.d.ts",
5
+ "main": "./lib-commonjs/index.js",
6
+ "module": "./lib-esm/index.js",
7
+ "types": "./dist/webpack-preserve-dynamic-require-plugin.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/webpack-preserve-dynamic-require-plugin.d.ts",
11
+ "import": "./lib-esm/index.js",
12
+ "require": "./lib-commonjs/index.js"
13
+ },
14
+ "./lib/*": {
15
+ "types": "./lib-dts/*.d.ts",
16
+ "import": "./lib-esm/*.js",
17
+ "require": "./lib-commonjs/*.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "typesVersions": {
22
+ "*": {
23
+ "lib/*": [
24
+ "lib-dts/*"
25
+ ]
26
+ }
27
+ },
7
28
  "license": "MIT",
8
29
  "repository": {
9
30
  "type": "git",
@@ -15,9 +36,9 @@
15
36
  },
16
37
  "devDependencies": {
17
38
  "eslint": "~9.37.0",
18
- "webpack": "~5.105.0",
19
- "local-node-rig": "1.0.0",
20
- "@rushstack/heft": "1.1.14"
39
+ "webpack": "~5.105.2",
40
+ "@rushstack/heft": "1.2.0",
41
+ "local-node-rig": "1.0.0"
21
42
  },
22
43
  "sideEffects": false,
23
44
  "scripts": {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes