diff --git a/.gitignore b/.gitignore index 3bcd2f234..c36664ebf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,10 @@ dist/**/*.js !scripts !src !src/*.js +!src/utils/ +!src/utils/*.js !test +!test/*.test.js !test/integration !test/integration/*.json !test/integration/*.js diff --git a/package.json b/package.json index 50d602c66..3bbe4647f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@sentry/node": "^7.66.0", "@slack/web-api": "^6.9.0", "@types/node": "^25.9.0", - "@vercel/webpack-asset-relocator-loader": "1.10.3", "analytics-node": "^6.2.0", "apollo-server-express": "^2.2.2", "arg": "^5.0.2", @@ -103,7 +102,6 @@ "terser": "^5.33.0", "the-answer": "^1.0.0", "tiny-json-http": "^7.5.1", - "ts-loader": "^9.5.7", "tsconfig-paths": "^4.2.0", "tsconfig-paths-webpack-plugin": "^4.1.0", "twilio": "^3.23.2", @@ -116,6 +114,10 @@ "when": "^3.7.8" }, "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319", + "dependencies": { + "@rspack/core": "^1.7.11", + "@vercel/webpack-asset-relocator-loader": "1.10.3" + }, "publishConfig": { "access": "public" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 077c3e202..5d6d93cdf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,13 @@ patchedDependencies: importers: .: + dependencies: + '@rspack/core': + specifier: ^1.7.11 + version: 1.7.11 + '@vercel/webpack-asset-relocator-loader': + specifier: 1.10.3 + version: 1.10.3(encoding@0.1.13) devDependencies: '@aws-sdk/client-s3': specifier: ^3.787.0 @@ -40,9 +47,6 @@ importers: '@types/node': specifier: ^25.9.0 version: 25.9.0 - '@vercel/webpack-asset-relocator-loader': - specifier: 1.10.3 - version: 1.10.3(encoding@0.1.13) analytics-node: specifier: ^6.2.0 version: 6.2.0 @@ -256,9 +260,6 @@ importers: tiny-json-http: specifier: ^7.5.1 version: 7.5.1 - ts-loader: - specifier: ^9.5.7 - version: 9.5.7(typescript@5.9.3)(webpack@5.94.0) tsconfig-paths: specifier: ^4.2.0 version: 4.2.0 @@ -643,6 +644,15 @@ packages: '@bugsnag/safe-json-stringify@6.1.0': resolution: {integrity: sha512-ImA35rnM7bGr+J30R979FQ95BhRB4UO1KfJA0J2sVqc8nwnrS9hhE5mkTmQWMs8Vh1Da+hkLKs5jJB4JjNZp4A==} + '@emnapi/core@1.10.0': + resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==} + + '@emnapi/runtime@1.10.0': + resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} + + '@emnapi/wasi-threads@1.2.1': + resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} + '@fastify/busboy@1.2.1': resolution: {integrity: sha512-7PQA7EH43S0CxcOa9OeAnaeA0oQ+e/DHNPZwSQM9CQHW76jle5+OvLdibRp/Aafs9KXbLhxyjOTkRjWUbQEd3Q==} engines: {node: '>=14'} @@ -1178,9 +1188,30 @@ packages: engines: {node: '>=18'} hasBin: true + '@module-federation/error-codes@0.22.0': + resolution: {integrity: sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug==} + + '@module-federation/runtime-core@0.22.0': + resolution: {integrity: sha512-GR1TcD6/s7zqItfhC87zAp30PqzvceoeDGYTgF3Vx2TXvsfDrhP6Qw9T4vudDQL3uJRne6t7CzdT29YyVxlgIA==} + + '@module-federation/runtime-tools@0.22.0': + resolution: {integrity: sha512-4ScUJ/aUfEernb+4PbLdhM/c60VHl698Gn1gY21m9vyC1Ucn69fPCA1y2EwcCB7IItseRMoNhdcWQnzt/OPCNA==} + + '@module-federation/runtime@0.22.0': + resolution: {integrity: sha512-38g5iPju2tPC3KHMPxRKmy4k4onNp6ypFPS1eKGsNLUkXgHsPMBFqAjDw96iEcjri91BrahG4XcdyKi97xZzlA==} + + '@module-federation/sdk@0.22.0': + resolution: {integrity: sha512-x4aFNBKn2KVQRuNVC5A7SnrSCSqyfIWmm1DvubjbO9iKFe7ith5niw8dqSFBekYBg2Fwy+eMg4sEFNVvCAdo6g==} + + '@module-federation/webpack-bundler-runtime@0.22.0': + resolution: {integrity: sha512-aM8gCqXu+/4wBmJtVeMeeMN5guw3chf+2i6HajKtQv7SJfxV/f4IyNQJUeUQu9HfiAZHjqtMV5Lvq/Lvh8LdyA==} + '@mongodb-js/saslprep@1.4.11': resolution: {integrity: sha512-o9rAHc0IpIjuPSxRutWpE1F62x7n+4mVS4rCNHkzhIUMQcc18bb6xEq5wd2NdN0WjepIyXIppRshYI2kQDOZVA==} + '@napi-rs/wasm-runtime@1.0.7': + resolution: {integrity: sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==} + '@nodable/entities@2.1.0': resolution: {integrity: sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==} @@ -1214,6 +1245,74 @@ packages: '@protobufjs/utf8@1.1.1': resolution: {integrity: sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==} + '@rspack/binding-darwin-arm64@1.7.11': + resolution: {integrity: sha512-oduECiZVqbO5zlVw+q7Vy65sJFth99fWPTyucwvLJJtJkPL5n17Uiql2cYP6Ijn0pkqtf1SXgK8WjiKLG5bIig==} + cpu: [arm64] + os: [darwin] + + '@rspack/binding-darwin-x64@1.7.11': + resolution: {integrity: sha512-a1+TtTE9ap6RalgFi7FGIgkJP6O4Vy6ctv+9WGJy53E4kuqHR0RygzaiVxCI/GMc/vBT9vY23hyrpWb3d1vtXA==} + cpu: [x64] + os: [darwin] + + '@rspack/binding-linux-arm64-gnu@1.7.11': + resolution: {integrity: sha512-P0QrGRPbTWu6RKWfN0bDtbnEps3rXH0MWIMreZABoUrVmNQKtXR6e73J3ub6a+di5s2+K0M2LJ9Bh2/H4UsDUA==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rspack/binding-linux-arm64-musl@1.7.11': + resolution: {integrity: sha512-6ky7R43VMjWwmx3Yx7Jl7faLBBMAgMDt+/bN35RgwjiPgsIByz65EwytUVuW9rikB43BGHvA/eqlnjLrUzNBqw==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rspack/binding-linux-x64-gnu@1.7.11': + resolution: {integrity: sha512-cuOJMfCOvb2Wgsry5enXJ3iT1FGUjdPqtGUBVupQlEG4ntSYsQ2PtF4wIDVasR3wdxC5nQbipOrDiN/u6fYsdQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rspack/binding-linux-x64-musl@1.7.11': + resolution: {integrity: sha512-CoK37hva4AmHGh3VCsQXmGr40L36m1/AdnN5LEjUX6kx5rEH7/1nEBN6Ii72pejqDVvk9anEROmPDiPw10tpFg==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rspack/binding-wasm32-wasi@1.7.11': + resolution: {integrity: sha512-OtrmnPUVJMxjNa3eDMfHyPdtlLRmmp/aIm0fQHlAOATbZvlGm12q7rhPW5BXTu1yh+1rQ1/uqvz+SzKEZXuJaQ==} + cpu: [wasm32] + + '@rspack/binding-win32-arm64-msvc@1.7.11': + resolution: {integrity: sha512-lObFW6e5lCWNgTBNwT//yiEDbsxm9QG4BYUojqeXxothuzJ/L6ibXz6+gLMvbOvLGV3nKgkXmx8GvT9WDKR0mA==} + cpu: [arm64] + os: [win32] + + '@rspack/binding-win32-ia32-msvc@1.7.11': + resolution: {integrity: sha512-0pYGnZd8PPqNR68zQ8skamqNAXEA1sUfXuAdYcknIIRq2wsbiwFzIc0Pov1cIfHYab37G7sSIPBiOUdOWF5Ivw==} + cpu: [ia32] + os: [win32] + + '@rspack/binding-win32-x64-msvc@1.7.11': + resolution: {integrity: sha512-EeQXayoQk/uBkI3pdoXfQBXNIUrADq56L3s/DFyM2pJeUDrWmhfIw2UFIGkYPTMSCo8F2JcdcGM32FGJrSnU0Q==} + cpu: [x64] + os: [win32] + + '@rspack/binding@1.7.11': + resolution: {integrity: sha512-2MGdy2s2HimsDT444Bp5XnALzNRxuBNc7y0JzyuqKbHBywd4x2NeXyhWXXoxufaCFu5PBc9Qq9jyfjW2Aeh06Q==} + + '@rspack/core@1.7.11': + resolution: {integrity: sha512-rsD9b+Khmot5DwCMiB3cqTQo53ioPG3M/A7BySu8+0+RS7GCxKm+Z+mtsjtG/vsu4Tn2tcqCdZtA3pgLoJB+ew==} + engines: {node: '>=18.12.0'} + peerDependencies: + '@swc/helpers': '>=0.5.1' + peerDependenciesMeta: + '@swc/helpers': + optional: true + + '@rspack/lite-tapable@1.1.0': + resolution: {integrity: sha512-E2B0JhYFmVAwdDiG14+DW0Di4Ze4Jg10Pc4/lILUrd5DRCaklduz2OvJ5HYQ6G+hd+WTzqQb3QnDNfK4yvAFYw==} + '@segment/loosely-validate-event@2.0.0': resolution: {integrity: sha512-ZMCSfztDBqwotkl848ODgVcAmN4OItEWDCkshcKz0/W6gGSQayuuCtWV/MlodFivAZD793d6UgANd6wCXUfrIw==} @@ -1332,6 +1431,9 @@ packages: resolution: {integrity: sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ==} engines: {node: '>= 10'} + '@tybys/wasm-util@0.10.2': + resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==} + '@types/accepts@1.3.7': resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==} @@ -7201,13 +7303,6 @@ packages: ts-invariant@0.4.4: resolution: {integrity: sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA==} - ts-loader@9.5.7: - resolution: {integrity: sha512-/ZNrKgA3K3PtpMYOC71EeMWIloGw3IYEa5/t1cyz2r5/PyUwTXGzYJvcD3kfUvmhlfpz1rhV8B2O6IVTQ0avsg==} - engines: {node: '>=12.0.0'} - peerDependencies: - typescript: '*' - webpack: ^5.0.0 - tsconfig-paths-webpack-plugin@4.2.0: resolution: {integrity: sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA==} engines: {node: '>=10.13.0'} @@ -8465,6 +8560,22 @@ snapshots: '@bugsnag/safe-json-stringify@6.1.0': {} + '@emnapi/core@1.10.0': + dependencies: + '@emnapi/wasi-threads': 1.2.1 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.10.0': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.1': + dependencies: + tslib: 2.8.1 + optional: true + '@fastify/busboy@1.2.1': dependencies: text-decoding: 1.0.0 @@ -9296,10 +9407,42 @@ snapshots: - encoding - supports-color + '@module-federation/error-codes@0.22.0': {} + + '@module-federation/runtime-core@0.22.0': + dependencies: + '@module-federation/error-codes': 0.22.0 + '@module-federation/sdk': 0.22.0 + + '@module-federation/runtime-tools@0.22.0': + dependencies: + '@module-federation/runtime': 0.22.0 + '@module-federation/webpack-bundler-runtime': 0.22.0 + + '@module-federation/runtime@0.22.0': + dependencies: + '@module-federation/error-codes': 0.22.0 + '@module-federation/runtime-core': 0.22.0 + '@module-federation/sdk': 0.22.0 + + '@module-federation/sdk@0.22.0': {} + + '@module-federation/webpack-bundler-runtime@0.22.0': + dependencies: + '@module-federation/runtime': 0.22.0 + '@module-federation/sdk': 0.22.0 + '@mongodb-js/saslprep@1.4.11': dependencies: sparse-bitfield: 3.0.3 + '@napi-rs/wasm-runtime@1.0.7': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@tybys/wasm-util': 0.10.2 + optional: true + '@nodable/entities@2.1.0': {} '@protobufjs/aspromise@1.1.2': {} @@ -9324,6 +9467,59 @@ snapshots: '@protobufjs/utf8@1.1.1': {} + '@rspack/binding-darwin-arm64@1.7.11': + optional: true + + '@rspack/binding-darwin-x64@1.7.11': + optional: true + + '@rspack/binding-linux-arm64-gnu@1.7.11': + optional: true + + '@rspack/binding-linux-arm64-musl@1.7.11': + optional: true + + '@rspack/binding-linux-x64-gnu@1.7.11': + optional: true + + '@rspack/binding-linux-x64-musl@1.7.11': + optional: true + + '@rspack/binding-wasm32-wasi@1.7.11': + dependencies: + '@napi-rs/wasm-runtime': 1.0.7 + optional: true + + '@rspack/binding-win32-arm64-msvc@1.7.11': + optional: true + + '@rspack/binding-win32-ia32-msvc@1.7.11': + optional: true + + '@rspack/binding-win32-x64-msvc@1.7.11': + optional: true + + '@rspack/binding@1.7.11': + optionalDependencies: + '@rspack/binding-darwin-arm64': 1.7.11 + '@rspack/binding-darwin-x64': 1.7.11 + '@rspack/binding-linux-arm64-gnu': 1.7.11 + '@rspack/binding-linux-arm64-musl': 1.7.11 + '@rspack/binding-linux-x64-gnu': 1.7.11 + '@rspack/binding-linux-x64-musl': 1.7.11 + '@rspack/binding-wasm32-wasi': 1.7.11 + '@rspack/binding-win32-arm64-msvc': 1.7.11 + '@rspack/binding-win32-ia32-msvc': 1.7.11 + '@rspack/binding-win32-x64-msvc': 1.7.11 + + '@rspack/core@1.7.11': + dependencies: + '@module-federation/runtime-tools': 0.22.0 + '@rspack/binding': 1.7.11 + '@rspack/lite-tapable': 1.1.0 + + '@rspack/lite-tapable@1.1.0': {} + '@segment/loosely-validate-event@2.0.0': dependencies: component-type: 1.2.2 @@ -9467,6 +9663,11 @@ snapshots: '@tootallnate/once@2.0.1': optional: true + '@tybys/wasm-util@0.10.2': + dependencies: + tslib: 2.8.1 + optional: true + '@types/accepts@1.3.7': dependencies: '@types/node': 25.9.0 @@ -16486,16 +16687,6 @@ snapshots: dependencies: tslib: 1.14.1 - ts-loader@9.5.7(typescript@5.9.3)(webpack@5.94.0): - dependencies: - chalk: 4.1.2 - enhanced-resolve: 5.21.4 - micromatch: 4.0.8 - semver: 7.8.0 - source-map: 0.7.6 - typescript: 5.9.3 - webpack: 5.94.0 - tsconfig-paths-webpack-plugin@4.2.0: dependencies: chalk: 4.1.2 diff --git a/scripts/build.js b/scripts/build.js index 14c02a6ae..77dc7250a 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -32,6 +32,7 @@ async function main() { __dirname + "/../src/index", { filename: "index.js", + externals: ["@rspack/core"], minify, cache, v8cache @@ -43,7 +44,15 @@ async function main() { const { code: relocateLoader, assets: relocateLoaderAssets } = await ncc( __dirname + "/../src/loaders/relocate-loader", - { filename: "relocate-loader.js", minify, cache, v8cache } + { + filename: "relocate-loader.js", + minify, + cache, + v8cache, + // Keep the asset relocator package external to this wrapper loader so the + // runtime dependency remains installed and loaded directly from node_modules. + externals: ["@vercel/webpack-asset-relocator-loader"] + } ); checkUnknownAssets('relocate-loader', Object.keys(relocateLoaderAssets)); diff --git a/src/cli.js b/src/cli.js index 974c12c62..9effb36fa 100755 --- a/src/cli.js +++ b/src/cli.js @@ -7,6 +7,7 @@ const rimraf = require("rimraf"); const crypto = require("crypto"); const { writeFileSync, unlink, existsSync, symlinkSync } = require("fs"); const { hasTypeModule } = require('./utils/has-type-module'); +const nodeModulesCandidates = require('./utils/node-modules-candidates'); const mkdirp = require("mkdirp"); const { version: nccVersion } = require('../package.json'); @@ -328,16 +329,8 @@ async function runCmd (argv, stdout, stderr) { if (run) { // find node_modules - const root = resolve('/node_modules'); - let nodeModulesDir = dirname(buildFile) + "/node_modules"; - do { - if (nodeModulesDir === root) { - nodeModulesDir = undefined; - break; - } - if (existsSync(nodeModulesDir)) - break; - } while (nodeModulesDir = resolve(nodeModulesDir, "../../node_modules")); + const nodeModulesDir = nodeModulesCandidates(dirname(buildFile)) + .find(candidate => existsSync(candidate)); if (nodeModulesDir) symlinkSync(nodeModulesDir, outDir + "/node_modules", "junction"); ps = require("child_process").fork(`${outDir}/index${ext}`, { diff --git a/src/index.js b/src/index.js index 8db368791..6c52803f9 100644 --- a/src/index.js +++ b/src/index.js @@ -1,18 +1,20 @@ const resolve = require("resolve"); const fs = require("graceful-fs"); const crypto = require("crypto"); -const { join, dirname, extname, resolve: pathResolve } = require("path"); -const webpack = require("webpack"); +const { join, dirname, extname, parse: pathParse, resolve: pathResolve, posix: pathPosix } = require("path"); +const { builtinModules } = require("module"); +const rspack = require("@rspack/core"); const MemoryFS = require("memory-fs"); const terser = require("terser"); -const tsconfigPaths = require("tsconfig-paths"); const { loadTsconfig } = require("tsconfig-paths/lib/tsconfig-loader"); -const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin"); const shebangRegEx = require('./utils/shebang'); const nccCacheDir = require("./utils/ncc-cache-dir"); const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin; const { version: nccVersion } = require('../package.json'); const { hasTypeModule } = require('./utils/has-type-module'); +const formatCompilationErrors = require('./utils/format-compilation-errors'); +const isResolverNotFoundError = require('./utils/is-resolver-not-found-error'); +const missingDependencyPaths = require('./utils/missing-dependency-paths'); // support glob graceful-fs fs.gracefulify(require("fs")); @@ -31,6 +33,53 @@ const defaultPermissions = 0o666; const relocateLoader = eval('require(__dirname + "/loaders/relocate-loader.js")'); +const esmAssetBase = "decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\\/\\/\\/\\w:/) ? 1 : 0, -1))"; +const builtinModuleSet = new Set(builtinModules); + +function ensureAssetBaseAssignment(code, assetName, esm, outputAssetBase = '') { + const assetBase = outputAssetBase + ? outputAssetBase.endsWith('/') || outputAssetBase.endsWith('\\') + ? outputAssetBase + : `${outputAssetBase}/` + : ''; + const dirName = pathPosix.dirname(assetName); + const relBaseValue = pathPosix.relative(dirName, '.'); + const relBase = relBaseValue && relBaseValue !== '.' ? `/${relBaseValue}` : ''; + const baseSuffix = `${relBase}/${assetBase}`; + const runtimeBase = esm ? esmAssetBase : '__dirname'; + const webpackRequire = '__webpack_require__'; + const assetBaseProperty = 'ab'; + const injection = `if (typeof ${webpackRequire} !== 'undefined') ${webpackRequire}.${assetBaseProperty} = ${runtimeBase} + ${JSON.stringify(baseSuffix)};`; + const existingAssignment = /if \(typeof __webpack_require__ !== 'undefined'\) __webpack_require__\.ab = [^;]+;/; + if (existingAssignment.test(code)) { + return code.replace(existingAssignment, injection); + } + const exportIndex = code.indexOf('var __webpack_exports__'); + if (exportIndex !== -1) { + return code.slice(0, exportIndex) + injection + code.slice(exportIndex); + } + const runtimeIndex = code.indexOf('__webpack_require__.m'); + if (runtimeIndex !== -1) { + return code.slice(0, runtimeIndex) + injection + code.slice(runtimeIndex); + } + return `${injection}${code}`; +} + +function ensureModuleExceptionHandling(code) { + const requireRuntime = + /\/\/ The module cache\nvar __webpack_module_cache__ = \{\};\n\n\/\/ The require function\nfunction __webpack_require__\(moduleId\) \{[\s\S]*?\/\/ Return the exports of the module[\s\S]*?return module\.exports;/g; + return code.replace(requireRuntime, runtime => runtime + .replace( + /if \(cachedModule\.error !== undefined\) throw cachedModule\.error;/, + "// ncc retries failed CommonJS modules on the next require." + ) + .replace( + /module\.error = e;\n(\s*)throw e;/, + "delete __webpack_module_cache__[moduleId];\n$1throw e;" + ) + ); +} + module.exports = ncc; function ncc ( entry, @@ -108,63 +157,43 @@ function ncc ( existingAssetNames.push(`${filename}.cache`); existingAssetNames.push(`${filename}.cache${ext}`); } - const resolvePlugins = []; // add TsconfigPathsPlugin to support `paths` resolution in tsconfig // we need to catch here because the plugin will // error if there's no tsconfig in the working directory let fullTsconfig = {}; + let resolveTsConfig; + let tsconfigDirectory = dirname(resolvedEntry); + let configFileAbsolutePath; try { - const configFileAbsolutePath = walkParentDirs({ - base: process.cwd(), - start: dirname(entry), - filename: 'tsconfig.json', - }); + if (process.env.TS_NODE_PROJECT) { + const configuredPath = pathResolve(process.env.TS_NODE_PROJECT); + configFileAbsolutePath = fs.statSync(configuredPath).isDirectory() + ? join(configuredPath, "tsconfig.json") + : configuredPath; + } else { + configFileAbsolutePath = walkParentDirs({ + base: pathParse(resolvedEntry).root, + start: dirname(resolvedEntry), + filename: 'tsconfig.json', + }); + } fullTsconfig = loadTsconfig(configFileAbsolutePath) || { compilerOptions: {} }; - - const tsconfigPathsOptions = { silent: true } - if (fullTsconfig.compilerOptions.allowJs) { - tsconfigPathsOptions.extensions = SUPPORTED_EXTENSIONS - } - resolvePlugins.push(new TsconfigPathsPlugin(tsconfigPathsOptions)); - - const tsconfig = tsconfigPaths.loadConfig(); - if (tsconfig.resultType === "success") { - tsconfigMatchPath = tsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths); - } - } catch (e) {} - - resolvePlugins.push({ - apply(resolver) { - const resolve = resolver.resolve; - resolver.resolve = function (context, path, request, resolveContext, callback) { - const self = this; - resolve.call(self, context, path, request, resolveContext, function (err, innerPath, result) { - if (result) return callback(null, innerPath, result); - if (err && !err.message.startsWith('Can\'t resolve')) - return callback(err); - // Allow .js resolutions to .tsx? from .tsx? - if (request.endsWith('.js') && context.issuer && (context.issuer.endsWith('.ts') || context.issuer.endsWith('.tsx'))) { - return resolve.call(self, context, path, request.slice(0, -3), resolveContext, function (err, innerPath, result) { - if (result) return callback(null, innerPath, result); - if (err && !err.message.startsWith('Can\'t resolve')) - return callback(err); - // make not found errors runtime errors - callback(null, __dirname + '/@@notfound.js?' + (externalMap.get(request) || request), request); - }); - } - // make not found errors runtime errors - callback(null, __dirname + '/@@notfound.js?' + (externalMap.get(request) || request), request); - }); + if (configFileAbsolutePath) { + tsconfigDirectory = dirname(configFileAbsolutePath); + resolveTsConfig = { + configFile: configFileAbsolutePath, + references: 'auto' }; } - }); + } catch (e) {} const externalMap = (() => { const regexps = []; const aliasMap = new Map(); const regexCache = new Map(); + const noRegexMatch = Symbol("no regex match"); function set(key, value) { if (key instanceof RegExp) @@ -174,7 +203,10 @@ function ncc ( function get(key) { if (aliasMap.has(key)) return aliasMap.get(key); - if (regexCache.has(key)) return regexCache.get(key); + if (regexCache.has(key)) { + const result = regexCache.get(key); + return result === noRegexMatch ? null : result; + } for (const regex of regexps) { const matches = key.match(regex) @@ -194,6 +226,7 @@ function ncc ( return result } } + regexCache.set(key, noRegexMatch); return null; } @@ -216,31 +249,176 @@ function ncc ( compilationStack.push(compilation); relocateLoader.initAssetCache(compilation); }); + compiler.hooks.compilation.tap("ncc", (compilation, { normalModuleFactory }) => { + if (!normalModuleFactory || !normalModuleFactory.hooks || !normalModuleFactory.hooks.beforeResolve) { + return; + } + const resolvers = new Map(); + const dependencyTypes = new Map(); + const getDependencyTypes = resolveData => { + if (resolveData.dependencyType) return [resolveData.dependencyType]; + const issuer = resolveData.contextInfo && resolveData.contextInfo.issuer; + const source = issuer || resolveData.request; + if (dependencyTypes.has(source)) return dependencyTypes.get(source); + const sourcePath = source.split('?', 1)[0]; + let primaryType; + if (/\.(?:mjs|mts|ts|tsx)$/.test(sourcePath)) { + primaryType = 'esm'; + } else if (/\.(?:cjs|cts)$/.test(sourcePath)) { + primaryType = 'commonjs'; + } else { + primaryType = hasTypeModule(sourcePath) || esm ? 'esm' : 'commonjs'; + } + const types = [ + primaryType, + primaryType === 'esm' ? 'commonjs' : 'esm', + 'url', + 'worker' + ]; + dependencyTypes.set(source, types); + return types; + }; + const getResolver = dependencyType => { + const key = dependencyType || 'undefined'; + if (!resolvers.has(key)) { + resolvers.set(key, normalModuleFactory.getResolver("normal", { dependencyType })); + } + return resolvers.get(key); + }; + const isBuiltin = request => { + if (!request) return false; + if (builtinModuleSet.has(request)) return true; + if (request.startsWith('node:')) { + return builtinModuleSet.has(request.slice(5)); + } + return false; + }; + const missingDependencyCache = new Map(); + const registeredMissingRequests = new Set(); + // A rewritten request is never resolved by rspack, so the paths that + // would satisfy it are only watched if ncc registers them itself. + const registerMissingDependencies = (request, context) => { + const missingDependencies = compilation.missingDependencies; + const fileDependencies = compilation.fileDependencies; + if (!missingDependencies || typeof missingDependencies.add !== 'function') return; + const key = `${context}\0${request}`; + if (registeredMissingRequests.has(key)) return; + registeredMissingRequests.add(key); + for (const path of missingDependencyPaths( + request, + context, + SUPPORTED_EXTENSIONS, + missingDependencyCache, + mainFields + )) { + const stats = missingDependencyCache.get(path); + const isFile = stats ? stats.isFile() : false; + if ( + isFile && + fileDependencies && + typeof fileDependencies.add === 'function' + ) { + fileDependencies.add(path); + } else { + missingDependencies.add(path); + } + } + }; + const resolveRequest = (resolveData, context, request, done) => { + const contextInfo = resolveData.contextInfo || { issuer: '' }; + const types = getDependencyTypes(resolveData); + let index = 0; + let lastError; + let shouldDefer = false; + const tryResolve = () => { + // A probe that resolves is resolved again by rspack, and a probe + // that misses reports no paths, so its resolve context is unused. + getResolver(types[index++]).resolve(contextInfo, context, request, {}, (err, result) => { + if (result) return done(null, result, false); + if (err) { + lastError = err; + if (!isResolverNotFoundError(err)) shouldDefer = true; + } + if (index < types.length) return tryResolve(); + done(lastError, undefined, shouldDefer); + }); + }; + tryResolve(); + }; + // Rspack does not currently expose a JS hook for recovering after a + // failed normal-module resolution (see web-infra-dev/rspack#14640), + // so ncc preserves runtime notfound semantics by probing here. + normalModuleFactory.hooks.beforeResolve.tapAsync("ncc", (resolveData, callback) => { + if (!resolveData || !resolveData.request) return callback(); + const request = resolveData.request; + if (request.includes('/@@notfound.js')) return callback(); + if (isBuiltin(request)) return callback(); + const external = externalMap.get(request); + if (external) return callback(); + + const issuer = resolveData.contextInfo && resolveData.contextInfo.issuer; + const context = resolveData.context || (issuer ? dirname(issuer) : process.cwd()); + const isTsIssuer = issuer && (issuer.endsWith('.ts') || issuer.endsWith('.tsx')); + const [requestPath, requestQuery] = request.split('?', 2); + const hasJsExtension = requestPath.endsWith('.js'); + const tsRequest = hasJsExtension + ? `${requestPath.slice(0, -3)}${requestQuery ? `?${requestQuery}` : ''}` + : null; + + const handleMissing = () => { + registerMissingDependencies(request, context); + if (tsRequest) registerMissingDependencies(tsRequest, context); + resolveData.request = __dirname + '/@@notfound.js?' + (external || request); + callback(); + }; + + const handleResolution = (err, result, shouldDefer) => { + if (shouldDefer) { + return callback(); + } + if (err && !isResolverNotFoundError(err)) { + return callback(err); + } + if (!err && result) { + return callback(); + } + return handleMissing(); + }; + + if (isTsIssuer && hasJsExtension) { + return resolveRequest(resolveData, context, request, (err, result, shouldDefer) => { + if (shouldDefer) { + return callback(); + } + if (err && !isResolverNotFoundError(err)) { + return callback(err); + } + if (!err && result) { + return callback(); + } + return resolveRequest(resolveData, context, tsRequest, (tsErr, tsResult, shouldDeferTs) => { + if (shouldDeferTs) { + return callback(); + } + if (tsErr && !isResolverNotFoundError(tsErr)) { + return callback(tsErr); + } + if (!tsErr && tsResult) { + resolveData.request = tsRequest; + return callback(); + } + return handleMissing(); + }); + }); + } + + return resolveRequest(resolveData, context, request, handleResolution); + }); + }); compiler.hooks.watchRun.tap("ncc", () => { if (rebuildHandler) rebuildHandler(); }); - compiler.hooks.normalModuleFactory.tap("ncc", NormalModuleFactory => { - function handler(parser) { - parser.hooks.assign.for("require").intercept({ - register: tapInfo => { - if (tapInfo.name !== "CommonJsPlugin") { - return tapInfo; - } - tapInfo.fn = () => {}; - return tapInfo; - } - }); - } - NormalModuleFactory.hooks.parser - .for("javascript/auto") - .tap("ncc", handler); - NormalModuleFactory.hooks.parser - .for("javascript/dynamic") - .tap("ncc", handler); - - return NormalModuleFactory; - }); } } ] @@ -253,28 +431,36 @@ function ncc ( } if (!esm) { - plugins.push(new webpack.DefinePlugin({ + plugins.push(new rspack.DefinePlugin({ 'import.meta.url': 'require("url").pathToFileURL(__filename).href' })); } - const compiler = webpack({ + const cacheEnabled = cache !== false; + const cacheDirectory = typeof cache === 'string' ? cache : nccCacheDir; + const experiments = { + topLevelAwait: true, + outputModule: esm + }; + if (cacheEnabled) { + experiments.cache = { + type: 'persistent', + version: `ncc_${hashOf(entry)}_${nccVersion}`, + snapshot: { + managedPaths: [] + }, + storage: { + type: 'filesystem', + directory: cacheDirectory + } + }; + } + + const compiler = rspack({ entry, - cache: cache === false ? undefined : { - type: "filesystem", - cacheDirectory: typeof cache === 'string' ? cache : nccCacheDir, - name: `ncc_${hashOf(entry)}`, - version: nccVersion - }, - snapshot: { - managedPaths: [], - module: { hash: true } - }, + cache: cacheEnabled, amd: false, - experiments: { - topLevelAwait: true, - outputModule: esm - }, + experiments, optimization: { nodeEnv: false, minimize: false, @@ -298,7 +484,9 @@ function ncc ( path: "/", // Webpack only emits sourcemaps for files ending in .js filename: ext === '.cjs' ? filename + '.js' : filename, - libraryTarget: esm ? 'module' : 'commonjs2', + library: { + type: esm ? 'module' : 'commonjs2' + }, strictModuleExceptionHandling: true, module: esm, devtoolModuleFilenameTemplate: sourceMapBasePrefix + '[resource-path]' @@ -322,7 +510,7 @@ function ncc ( undefined: cjsDeps() }, mainFields, - plugins: resolvePlugins + ...(resolveTsConfig ? { tsConfig: resolveTsConfig } : {}) }, // https://github.com/vercel/ncc/pull/29#pullrequestreview-177152175 node: false, @@ -365,6 +553,8 @@ function ncc ( options: { transpileOnly, compiler: eval('__dirname + "/typescript.js"'), + configFilePath: configFileAbsolutePath, + configFileDirectory: tsconfigDirectory, compilerOptions: { module: 'esnext', target: 'esnext', @@ -401,8 +591,10 @@ function ncc ( compiler.close(err => { if (err) return reject(err); if (stats.hasErrors()) { - const errLog = [...stats.compilation.errors].map(err => err.message).join('\n'); - return reject(new Error(errLog)); + const errLog = formatCompilationErrors([...stats.compilation.errors]); + const compilationError = new Error(errLog); + compilationError.nccError = true; + return reject(compilationError); } resolve(stats); }); @@ -417,11 +609,61 @@ function ncc ( if (typeof watch === 'object') { if (!watch.watch) throw new Error('Watcher class must be a valid Webpack WatchFileSystem class instance (https://github.com/webpack/webpack/blob/master/lib/node/NodeWatchFileSystem.js)'); + const wrapDependencySet = entries => { + if (!entries || entries._set) return entries; + const set = entries instanceof Set ? entries : new Set(entries); + return { + _set: set, + [Symbol.iterator]: () => set[Symbol.iterator]() + }; + }; + const originalWatch = watch.watch.bind(watch); + watch.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => { + const toSet = entries => { + if (!entries) return new Set(); + if (entries instanceof Set) return new Set(entries); + return new Set(entries); + }; + const adaptedCallback = ( + err, + fileTimeInfoEntries, + contextTimeInfoEntries, + changedOrRemovedFiles, + removedFiles + ) => { + // Support both callback variants: + // - webpack/rspack: (..., changedFiles, removedFiles) + // - legacy/custom watchers: (..., removedFiles) + const hasChangedAndRemoved = removedFiles !== undefined; + const changed = hasChangedAndRemoved ? toSet(changedOrRemovedFiles) : new Set(); + const removed = hasChangedAndRemoved ? toSet(removedFiles) : toSet(changedOrRemovedFiles); + callback(err, fileTimeInfoEntries, contextTimeInfoEntries, changed, removed); + }; + const adaptedCallbackUndelayed = (fileName, changeTime) => { + if (typeof callbackUndelayed === 'function') { + callbackUndelayed(fileName, changeTime); + } + }; + return originalWatch( + wrapDependencySet(files), + wrapDependencySet(dirs), + wrapDependencySet(missing), + startTime, + options, + adaptedCallback, + adaptedCallbackUndelayed + ); + }; compiler.watchFileSystem = watch; watch.inputFileSystem = compiler.inputFileSystem; + if (watch.inputFileSystem && !watch.inputFileSystem.purge) { + watch.inputFileSystem.purge = () => {}; + } } let cachedResult; - watcher = compiler.watch({}, async (err, stats) => { + // ncc bundles dependency source, so a change inside node_modules changes + // the output. Rspack ignores node_modules by default. + watcher = compiler.watch({ ignored: [] }, async (err, stats) => { if (err) { compilationStack.pop(); return watchHandler({ err }); @@ -480,6 +722,8 @@ function ncc ( delete assets[`${filename}${ext === '.cjs' ? '.js' : ''}.map`]; let code = mfs.readFileSync(`/${filename}${ext === '.cjs' ? '.js' : ''}`, "utf8"); let map = sourceMap ? JSON.parse(mfs.readFileSync(`/${filename}${ext === '.cjs' ? '.js' : ''}.map`, "utf8")) : null; + code = ensureAssetBaseAssignment(code, filename, esm); + code = ensureModuleExceptionHandling(code); if (minify) { let result; @@ -679,6 +923,9 @@ function walkParentDirs({ } parent = dirname(current); + if (parent === current) { + break; + } } return null; diff --git a/src/loaders/relocate-loader.js b/src/loaders/relocate-loader.js index aa1587576..d4e2652fb 100644 --- a/src/loaders/relocate-loader.js +++ b/src/loaders/relocate-loader.js @@ -1 +1,44 @@ -module.exports = require('@vercel/webpack-asset-relocator-loader'); +const relocateLoader = require('@vercel/webpack-asset-relocator-loader'); +const fs = require('fs'); + +function wrappedRelocateLoader(content, map) { + if (this.resourcePath && this.resourcePath.endsWith('.node')) { + try { + const fileBuffer = fs.readFileSync(this.resourcePath); + if (!Buffer.isBuffer(content) || content.length !== fileBuffer.length) { + content = fileBuffer; + } + } catch (e) { + // keep original content on read failure + } + } + // Guard the pinned relocator's JSON TDZ bug at asset-relocator.js:410. + if (this.resourcePath && this.resourcePath.endsWith('.json') && content !== undefined && content !== null) { + const callback = this.async(); + const result = typeof content === 'string' ? content : content.toString(); + if (callback) { + callback(null, result, map); + return; + } + return result; + } + if (content === undefined || content === null) { + const callback = this.async(); + if (callback) { + callback(null, content, map); + return; + } + return content; + } + return relocateLoader.call(this, content, map); +} + +wrappedRelocateLoader.raw = relocateLoader.raw; +wrappedRelocateLoader.getAssetMeta = relocateLoader.getAssetMeta; +wrappedRelocateLoader.getSymlinks = relocateLoader.getSymlinks; +wrappedRelocateLoader.initAssetCache = function initAssetCache(compilation, outputAssetBase) { + return relocateLoader.initAssetCache(compilation, outputAssetBase); +}; +wrappedRelocateLoader.initAssetMetaCache = wrappedRelocateLoader.initAssetCache; + +module.exports = wrappedRelocateLoader; diff --git a/src/loaders/ts-loader.js b/src/loaders/ts-loader.js index 71f654808..bac12c884 100644 --- a/src/loaders/ts-loader.js +++ b/src/loaders/ts-loader.js @@ -1,24 +1,240 @@ -// we re-export so that we generate a unique -// optional bundle for the ts-loader, that -// doesn't get loaded unless the user is -// compiling typescript -const logger = require("ts-loader/dist/logger"); -const makeLogger = logger.makeLogger; -logger.makeLogger = function (loaderOptions, colors) { - const instance = makeLogger(loaderOptions, colors); - const logWarning = instance.logWarning; - instance.logWarning = function (message) { - // Disable TS Loader TypeScript compatibility warning - if (message.indexOf('This version may or may not be compatible with ts-loader') !== -1) - return; - return logWarning(message); +const path = require("path"); + +function getCompiler(options) { + if (options && options.compiler) { + if (typeof options.compiler === "string") { + return require(options.compiler); + } + return options.compiler; + } + return require("typescript"); +} + +function formatDiagnostics(typescript, diagnostics) { + if (!diagnostics || !diagnostics.length) return null; + const formatHost = { + getCanonicalFileName: fileName => fileName, + getCurrentDirectory: () => process.cwd(), + getNewLine: () => typescript.sys.newLine || '\n' }; - return instance; -}; + if (typescript.formatDiagnostics) { + return typescript.formatDiagnostics(diagnostics, formatHost); + } + return typescript.formatDiagnosticsWithColorAndContext + ? typescript.formatDiagnosticsWithColorAndContext(diagnostics, formatHost) + : null; +} + +function dedupeDiagnostics(compilation, typescript, diagnostics) { + if (!compilation || !diagnostics || diagnostics.length === 0) return diagnostics; + if (!compilation.__nccTsLoaderDiagnostics) { + compilation.__nccTsLoaderDiagnostics = new Set(); + } + return diagnostics.filter(diagnostic => { + const message = typescript.flattenDiagnosticMessageText + ? typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + : String(diagnostic.messageText); + const fileName = diagnostic.file ? diagnostic.file.fileName : ""; + const key = [ + diagnostic.code, + diagnostic.category, + fileName, + diagnostic.start, + diagnostic.length, + message + ].join("\0"); + if (compilation.__nccTsLoaderDiagnostics.has(key)) return false; + compilation.__nccTsLoaderDiagnostics.add(key); + return true; + }); +} -module.exports = require("ts-loader"); +function splitDiagnostics(typescript, diagnostics) { + const errorCategory = typescript.DiagnosticCategory + ? typescript.DiagnosticCategory.Error + : 1; + const errors = []; + const warnings = []; + for (const diagnostic of diagnostics || []) { + (diagnostic.category === errorCategory ? errors : warnings).push(diagnostic); + } + return { errors, warnings }; +} + +function reportDiagnostics(typescript, diagnostics, emitError, emitWarning) { + const { errors, warnings } = splitDiagnostics(typescript, diagnostics); + const errorsText = formatDiagnostics(typescript, errors); + if (errorsText) { + emitError(new Error(errorsText)); + } + const warningsText = formatDiagnostics(typescript, warnings); + if (warningsText && emitWarning) { + emitWarning(new Error(warningsText)); + } +} + +function getTypeCheckState(loaderContext, typescript, parsedOptions) { + const compilation = loaderContext._compilation; + if (!compilation || !compilation.hooks || !compilation.hooks.finishModules || !compilation.errors) { + return null; + } + const stateKey = JSON.stringify(parsedOptions); + if (!compilation.__nccTsLoaderState) { + compilation.__nccTsLoaderState = new Map(); + } + if (compilation.__nccTsLoaderState.has(stateKey)) { + return compilation.__nccTsLoaderState.get(stateKey); + } + const state = { + files: new Set(), + host: typescript.createCompilerHost(parsedOptions), + program: null, + emitDiagnostics: [], + emitAsset: typeof compilation.emitAsset === "function" + ? compilation.emitAsset.bind(compilation) + : null + }; + compilation.__nccTsLoaderState.set(stateKey, state); + compilation.hooks.finishModules.tap("ncc-ts-loader", () => { + const program = state.program; + let diagnostics = state.emitDiagnostics.concat( + typescript.getPreEmitDiagnostics(program) + ); + if ( + state.emitAsset && + !parsedOptions.noEmit && + (parsedOptions.declaration || parsedOptions.composite) + ) { + const outputDirectory = parsedOptions.declarationDir || parsedOptions.outDir; + const emitResult = program.emit( + undefined, + (outputPath, content) => { + if (!/\.d\.(?:ts|mts|cts)(?:\.map)?$/.test(outputPath)) return; + let assetName = outputDirectory + ? path.relative(outputDirectory, outputPath) + : path.basename(outputPath); + if (assetName.startsWith("..") || path.isAbsolute(assetName)) { + assetName = path.basename(outputPath); + } + state.emitAsset(assetName.split(path.sep).join("/"), { + source: () => content, + size: () => Buffer.byteLength(content) + }); + }, + undefined, + true + ); + diagnostics = diagnostics.concat(emitResult.diagnostics || []); + } + diagnostics = dedupeDiagnostics( + compilation, + typescript, + diagnostics + ); + reportDiagnostics( + typescript, + diagnostics, + error => compilation.errors.push(error), + compilation.warnings + ? warning => compilation.warnings.push(warning) + : null + ); + }); + return state; +} -// ts-loader internally has a require("typescript") that applies -// regardless of "compiler". -// We could remap this too, as soon as ncc supports aliased externals -module.exports.typescript = require("typescript"); +module.exports = function tsTranspileLoader(input, inputSourceMap) { + if (this.cacheable) this.cacheable(); + const callback = this.async(); + const options = this.getOptions ? this.getOptions() : this.query || {}; + if (options.configFilePath && this.addDependency) { + this.addDependency(options.configFilePath); + } + const typescript = getCompiler(options); + const compilerOptions = Object.assign({}, options.compilerOptions); + if (compilerOptions.skipLibCheck === undefined) { + compilerOptions.skipLibCheck = true; + } + if (this.sourceMap && compilerOptions.sourceMap !== false && compilerOptions.inlineSourceMap !== true) { + compilerOptions.sourceMap = true; + } + const fileName = this.resourcePath; + if (!fileName.endsWith('.ts') && !fileName.endsWith('.tsx')) { + callback(null, input, inputSourceMap); + return; + } + const configFileDirectory = options.configFileDirectory || path.dirname(fileName); + const parsedConfig = typescript.convertCompilerOptionsFromJson + ? typescript.convertCompilerOptionsFromJson(compilerOptions, configFileDirectory) + : { options: compilerOptions, errors: [] }; + const parsedOptions = parsedConfig.options || compilerOptions; + let outputText; + let sourceMapText; + let diagnostics = parsedConfig.errors || []; + const typeCheckState = options.transpileOnly + ? null + : getTypeCheckState(this, typescript, parsedOptions); + + if (typeCheckState) { + typeCheckState.files.add(fileName); + if ( + !typeCheckState.program || + !typeCheckState.program.getSourceFile(fileName) + ) { + typeCheckState.program = typescript.createProgram( + Array.from(typeCheckState.files), + parsedOptions, + typeCheckState.host, + typeCheckState.program || undefined + ); + } + const sourceFile = typeCheckState.program.getSourceFile(fileName); + const emitResult = typeCheckState.program.emit( + sourceFile, + (outputPath, content) => { + if (/\.d\.(?:ts|mts|cts)(?:\.map)?$/.test(outputPath)) { + return; + } + if (outputPath.endsWith(".map")) { + sourceMapText = content; + } else { + outputText = content; + } + } + ); + typeCheckState.emitDiagnostics.push(...(emitResult.diagnostics || [])); + } else { + const result = typescript.transpileModule(input.toString(), { + fileName, + compilerOptions: parsedOptions, + reportDiagnostics: true + }); + outputText = result.outputText; + sourceMapText = result.sourceMapText; + diagnostics = diagnostics.concat(result.diagnostics || []); + } + + if (!options.transpileOnly && !typeCheckState) { + const host = typescript.createCompilerHost(parsedOptions); + const program = typescript.createProgram([fileName], parsedOptions, host); + diagnostics = diagnostics.concat(typescript.getPreEmitDiagnostics(program)); + } + + diagnostics = dedupeDiagnostics(this._compilation, typescript, diagnostics); + reportDiagnostics( + typescript, + diagnostics, + error => this.emitError(error), + this.emitWarning ? warning => this.emitWarning(warning) : null + ); + + let map = inputSourceMap; + if (sourceMapText) { + map = JSON.parse(sourceMapText); + map.file = path.basename(fileName); + map.sources = [fileName]; + map.sourcesContent = [input.toString()]; + } + + callback(null, outputText, map); +}; diff --git a/src/utils/format-compilation-errors.js b/src/utils/format-compilation-errors.js new file mode 100644 index 000000000..b006d9da6 --- /dev/null +++ b/src/utils/format-compilation-errors.js @@ -0,0 +1,10 @@ +module.exports = function formatCompilationErrors(errors) { + return errors.map(err => { + const message = err && err.message ? err.message : String(err); + const withoutStackFrames = message + .split('\n') + .filter(line => !line.trim().startsWith('at ')) + .join('\n'); + return withoutStackFrames.trim() ? withoutStackFrames : message; + }).join('\n'); +}; diff --git a/src/utils/is-resolver-not-found-error.js b/src/utils/is-resolver-not-found-error.js new file mode 100644 index 000000000..250126031 --- /dev/null +++ b/src/utils/is-resolver-not-found-error.js @@ -0,0 +1,11 @@ +const rspackNotFoundError = /^RspackResolver\((?:NotFound|MatchedAliasNotFound|ExtensionAlias)\b/; + +module.exports = function isResolverNotFoundError(err) { + if (!err) return false; + if (err.code === 'MODULE_NOT_FOUND' || err.code === 'ModuleNotFoundError') return true; + if (err.name === 'ModuleNotFoundError') return true; + if (!err.message) return false; + return rspackNotFoundError.test(err.message) || + err.message.startsWith("Can't resolve") || + err.message.startsWith("Cannot resolve"); +}; diff --git a/src/utils/missing-dependency-paths.js b/src/utils/missing-dependency-paths.js new file mode 100644 index 000000000..c641683bc --- /dev/null +++ b/src/utils/missing-dependency-paths.js @@ -0,0 +1,248 @@ +const fs = require("graceful-fs"); +const { basename, dirname, isAbsolute, join, resolve: pathResolve } = require("path"); + +const packageRequest = /^(@[^/]+\/[^/]+|[^/]+)(\/.*)?$/; +const schemeRequest = /^[a-zA-Z][a-zA-Z\d+\-.]*:/; + +const getStats = (path, cache) => { + if (!cache.has(path)) { + let stats = null; + try { + stats = fs.statSync(path); + } catch (e) {} + cache.set(path, stats); + } + return cache.get(path); +}; + +const isDirectory = (path, cache) => { + const stats = getStats(path, cache); + return stats ? stats.isDirectory() : false; +}; + +// Watching a candidate only pays off up to its first missing segment: creating +// that segment invalidates the build, and the next build probes one level +// deeper. Registering the full path instead would make rspack watch the closest +// existing ancestor, which can be far enough up the tree to be recursive. +const firstMissingSegment = (path, cache) => { + if (isDirectory(path, cache)) return null; + let current = path; + let parent = dirname(current); + while (parent !== current) { + if (isDirectory(parent, cache)) return current; + current = parent; + parent = dirname(current); + } + return null; +}; + +const lookupDirectories = context => { + const directories = []; + let current = context; + let parent = dirname(current); + while (true) { + if (basename(current) !== "node_modules") directories.push(current); + if (parent === current) return directories; + current = parent; + parent = dirname(current); + } +}; + +const findPackageScope = (context, cache) => { + const packageJsonCandidates = []; + for (const directory of lookupDirectories(context)) { + const packageJson = join(directory, "package.json"); + packageJsonCandidates.push(packageJson); + try { + const stats = getStats(packageJson, cache); + if (stats && stats.isFile()) { + return { + directory, + packageJson, + packageJsonCandidates, + data: JSON.parse(fs.readFileSync(packageJson, "utf8")) + }; + } + } catch (e) {} + } + return { packageJsonCandidates }; +}; + +const moduleCandidates = (base, extensions) => { + const candidates = [base, join(base, "package.json")]; + for (const extension of extensions) + candidates.push(join(base, `index${extension}`)); + return candidates; +}; + +const fileCandidates = (base, extensions) => { + const candidates = moduleCandidates(base, extensions); + for (const extension of extensions) candidates.push(base + extension); + return candidates; +}; + +const findMappings = (mapping, key) => { + if (!mapping || typeof mapping !== "object" || Array.isArray(mapping)) { + return key === "." ? [{ value: mapping, wildcard: "" }] : []; + } + if (Object.prototype.hasOwnProperty.call(mapping, key)) { + return [{ value: mapping[key], wildcard: "" }]; + } + const matches = []; + for (const pattern of Object.keys(mapping)) { + const star = pattern.indexOf("*"); + if (star === -1) continue; + const prefix = pattern.slice(0, star); + const suffix = pattern.slice(star + 1); + if (!key.startsWith(prefix) || !key.endsWith(suffix)) continue; + matches.push({ + value: mapping[pattern], + wildcard: key.slice(prefix.length, key.length - suffix.length) + }); + } + if (matches.length) return matches; + const isConditionalMap = !Object.keys(mapping).some(name => + name.startsWith(".") || name.startsWith("#") + ); + return key === "." && isConditionalMap + ? [{ value: mapping, wildcard: "" }] + : []; +}; + +const bareTargetCandidates = ( + request, + context, + extensions, + mainFields, + seen = new Set() +) => { + const seenKey = `bare\0${context}\0${request}`; + if (seen.has(seenKey)) return []; + seen.add(seenKey); + const match = packageRequest.exec(request); + if (!match) return []; + const [, name, subpath] = match; + const candidates = []; + for (const directory of lookupDirectories(context)) { + const packageDirectory = join(directory, "node_modules", name); + const packageJson = join(packageDirectory, "package.json"); + candidates.push(...(subpath + ? [packageJson, ...fileCandidates(join(packageDirectory, subpath), extensions)] + : moduleCandidates(packageDirectory, extensions))); + try { + const data = JSON.parse(fs.readFileSync(packageJson, "utf8")); + candidates.push( + ...mappedTargetCandidates( + data.exports, + subpath ? `.${subpath}` : ".", + packageDirectory, + extensions, + mainFields, + seen + ) + ); + if (!subpath) { + for (const field of mainFields) { + if (typeof data[field] === "string") { + candidates.push( + ...fileCandidates(pathResolve(packageDirectory, data[field]), extensions) + ); + } + } + } + } catch (e) {} + } + return candidates; +}; + +const mappedTargetCandidates = ( + mapping, + key, + packageDirectory, + extensions, + mainFields, + seen = new Set() +) => { + const seenKey = `mapping\0${packageDirectory}\0${key}`; + if (seen.has(seenKey)) return []; + seen.add(seenKey); + const matches = findMappings(mapping, key); + const targets = []; + const addTargets = (value, wildcard) => { + if (typeof value === "string") { + const target = value.replace(/\*/g, wildcard); + if (target.startsWith("./")) { + targets.push(...fileCandidates(pathResolve(packageDirectory, target), extensions)); + } else if (!target.startsWith("#") && !schemeRequest.test(target)) { + targets.push( + ...bareTargetCandidates( + target, + packageDirectory, + extensions, + mainFields, + seen + ) + ); + } + } else if (Array.isArray(value)) { + value.forEach(item => addTargets(item, wildcard)); + } else if (value && typeof value === "object") { + Object.values(value).forEach(item => addTargets(item, wildcard)); + } + }; + matches.forEach(match => addTargets(match.value, match.wildcard)); + return targets; +}; + +// Rspack resolves in Rust and only reports the paths a resolver touched when the +// request resolves, so a miss arrives with no dependency information at all +// (see web-infra-dev/rspack#14640). ncc turns misses into runtime errors instead +// of build failures, which means nothing else records them either, so derive the +// paths whose creation could make the request resolve. +module.exports = function missingDependencyPaths( + request, + context, + extensions, + cache = new Map(), + mainFields = ["main"] +) { + const requestPath = request.startsWith("#") + ? request.split("?", 1)[0] + : request.split(/[?#]/, 1)[0]; + if (!requestPath) return []; + + let candidates; + if (requestPath.startsWith(".") || isAbsolute(requestPath)) { + candidates = fileCandidates(pathResolve(context, requestPath), extensions); + } else if (requestPath.startsWith("#")) { + const scope = findPackageScope(context, cache); + candidates = scope.packageJson + ? [ + scope.packageJson, + ...mappedTargetCandidates( + scope.data && scope.data.imports, + requestPath, + scope.directory, + extensions, + mainFields + ) + ] + : scope.packageJsonCandidates; + } else if (schemeRequest.test(requestPath)) { + return []; + } else { + candidates = bareTargetCandidates( + requestPath, + context, + extensions, + mainFields + ); + } + + const paths = new Set(); + for (const candidate of candidates) { + const missing = firstMissingSegment(candidate, cache); + if (missing) paths.add(missing); + } + return [...paths]; +}; diff --git a/src/utils/node-modules-candidates.js b/src/utils/node-modules-candidates.js new file mode 100644 index 000000000..b50dd246e --- /dev/null +++ b/src/utils/node-modules-candidates.js @@ -0,0 +1,20 @@ +const path = require("path"); + +// Every node_modules directory between a starting directory and its filesystem +// root, nearest first, excluding the root itself. +// +// Comparing a directory against its own parent is the only stop condition that +// holds on every platform. `resolve("/node_modules")` does not: on Windows it +// resolves against the drive of the current working directory, so walking up +// from a directory on another drive reaches that drive's root and stays there. +module.exports = function nodeModulesCandidates (start, { dirname, join } = path) { + const candidates = []; + let current = start; + let parent = dirname(current); + while (parent !== current) { + candidates.push(join(current, "node_modules")); + current = parent; + parent = dirname(current); + } + return candidates; +}; diff --git a/test/review-regressions.test.js b/test/review-regressions.test.js new file mode 100644 index 000000000..507eddbcf --- /dev/null +++ b/test/review-regressions.test.js @@ -0,0 +1,764 @@ +const fs = require("fs"); +const os = require("os"); +const path = require("path"); +const { execFileSync } = require("child_process"); +const { Writable } = require("stream"); + +const ncc = require("../src/index"); +const runCmd = require("../src/cli"); +const formatCompilationErrors = require("../src/utils/format-compilation-errors"); +const isResolverNotFoundError = require("../src/utils/is-resolver-not-found-error"); +const missingDependencyPaths = require("../src/utils/missing-dependency-paths"); +const nodeModulesCandidates = require("../src/utils/node-modules-candidates"); +const relocateLoader = require("../src/loaders/relocate-loader"); +const tsLoader = require("../src/loaders/ts-loader"); + +jest.setTimeout(20000); + +// A child that never exits would block the suite for the whole job timeout, +// because execFileSync cannot be interrupted by the per-test timeout. +function runNode(...args) { + return execFileSync(process.execPath, args, { encoding: "utf8", timeout: 15000 }); +} + +class StoreStream extends Writable { + constructor() { + super(); + this.data = ""; + } + + _write(chunk, encoding, callback) { + this.data += chunk.toString(); + callback(); + } +} + +function createWatchFileSystem(onWatch) { + return { + watch(...args) { + onWatch(...args); + return { + close() {}, + pause() {}, + getInfo: () => ({ + changes: new Set(), + removals: new Set(), + fileTimeInfoEntries: new Map(), + contextTimeInfoEntries: new Map() + }) + }; + } + }; +} + +async function runWatchedBuild(input, options, onWatch) { + const watcher = ncc(input, { + cache: false, + quiet: true, + ...options, + watch: createWatchFileSystem(onWatch) + }); + const result = await new Promise((resolve, reject) => { + watcher.handler(value => value.err ? reject(value.err) : resolve(value)); + }); + await new Promise(resolve => setImmediate(resolve)); + watcher.close(); + return result; +} + +describe("review regressions", () => { + let tmpDir; + + beforeEach(() => { + // The compilation records the resolver's real paths, while os.tmpdir() is a + // symlink on macOS (/var -> /private/var) and an 8.3 short name on Windows, + // so paths built from it directly would never match what was registered. + tmpDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), "ncc-review-"))); + }); + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }); + }); + + it("preserves ncc run child exit details in API mode", async () => { + const input = path.join(tmpDir, "exit.js"); + fs.writeFileSync(input, "process.exit(7);\n"); + const stdout = new StoreStream(); + const stderr = new StoreStream(); + + await expect(runCmd(["run", "--no-cache", input], stdout, stderr)).rejects.toMatchObject({ + silent: true, + exitCode: 7 + }); + expect(stderr.data).toBe(""); + }); + + it("evicts a module from the cache when its factory throws", async () => { + const flaky = path.join(tmpDir, "flaky.js"); + fs.writeFileSync(flaky, [ + "global.__nccModuleAttempts = (global.__nccModuleAttempts || 0) + 1;", + "if (global.__nccModuleAttempts === 1) throw new Error('first attempt');", + "module.exports = 'recovered';" + ].join("\n")); + const input = path.join(tmpDir, "entry.js"); + fs.writeFileSync(input, [ + "try { require('./flaky'); } catch (error) {}", + "module.exports = require('./flaky');" + ].join("\n")); + + const { code } = await ncc(input, { cache: false, quiet: true }); + const output = path.join(tmpDir, "output.js"); + fs.writeFileSync(output, code); + + expect(require(output)).toBe("recovered"); + expect(global.__nccModuleAttempts).toBe(2); + delete global.__nccModuleAttempts; + }); + + it("does not rewrite module-cache-like user code", async () => { + const input = path.join(tmpDir, "entry.js"); + fs.writeFileSync(input, [ + "// The require function", + "const cachedModule = { error: new Error('user error') };", + "let caught = false;", + "try {", + " if (cachedModule.error !== undefined) throw cachedModule.error;", + "} catch (error) {", + " caught = error.message === 'user error';", + "}", + "module.exports = caught;" + ].join("\n")); + + const { code } = await ncc(input, { cache: false, quiet: true }); + const output = path.join(tmpDir, "output.js"); + fs.writeFileSync(output, code); + + expect(require(output)).toBe(true); + }); + + it("uses dependency conditions when probing ESM package exports", async () => { + const packageDir = path.join(tmpDir, "node_modules", "import-only"); + fs.mkdirSync(packageDir, { recursive: true }); + fs.writeFileSync(path.join(packageDir, "package.json"), JSON.stringify({ + name: "import-only", + type: "module", + exports: { + ".": { + import: "./import.js" + } + } + })); + fs.writeFileSync(path.join(packageDir, "import.js"), "export default 'conditional-import-ok';\n"); + const input = path.join(tmpDir, "entry.mjs"); + fs.writeFileSync(input, "import value from 'import-only'; console.log(value);\n"); + + const { code } = await ncc(input, { cache: false, esm: true, quiet: true }); + const output = path.join(tmpDir, "output.mjs"); + fs.writeFileSync(output, code); + const result = runNode(output); + + expect(result.trim()).toBe("conditional-import-ok"); + }); + + it("tries ESM conditions for dynamic import from a CommonJS issuer", async () => { + const packageDir = path.join(tmpDir, "node_modules", "import-only"); + fs.mkdirSync(packageDir, { recursive: true }); + fs.writeFileSync(path.join(packageDir, "package.json"), JSON.stringify({ + name: "import-only", + type: "module", + exports: { + ".": { + import: "./import.js" + } + } + })); + fs.writeFileSync(path.join(packageDir, "import.js"), "export default 'dynamic-import-ok';\n"); + const input = path.join(tmpDir, "entry.cjs"); + fs.writeFileSync(input, "import('import-only').then(value => console.log(value.default));\n"); + + const { code, assets } = await ncc(input, { cache: false, quiet: true }); + const output = path.join(tmpDir, "output.cjs"); + fs.writeFileSync(output, code); + for (const [name, asset] of Object.entries(assets)) { + const assetPath = path.join(tmpDir, name); + fs.mkdirSync(path.dirname(assetPath), { recursive: true }); + fs.writeFileSync(assetPath, asset.source); + } + const result = runNode(output); + + expect(result.trim()).toBe("dynamic-import-ok"); + }); + + it("tries CommonJS conditions for require from a TypeScript issuer", async () => { + const packageDir = path.join(tmpDir, "node_modules", "require-only"); + fs.mkdirSync(packageDir, { recursive: true }); + fs.writeFileSync(path.join(packageDir, "package.json"), JSON.stringify({ + name: "require-only", + exports: { + ".": { + require: "./require.js" + } + } + })); + fs.writeFileSync(path.join(packageDir, "require.js"), "module.exports = 'require-ok';\n"); + const input = path.join(tmpDir, "entry.ts"); + fs.writeFileSync(input, "console.log(require('require-only'));\n"); + + const { code } = await ncc(input, { cache: false, quiet: true, transpileOnly: true }); + const output = path.join(tmpDir, "output.js"); + fs.writeFileSync(output, code); + const result = runNode(output); + + expect(result.trim()).toBe("require-ok"); + }); + + it("reports TypeScript syntax errors in transpile-only mode", async () => { + const input = path.join(tmpDir, "entry.ts"); + fs.writeFileSync(input, "const value: = 1;\n"); + + await expect(ncc(input, { + cache: false, + quiet: true, + transpileOnly: true + })).rejects.toThrow(/TS1110/); + }); + + it("preserves whole-program TypeScript emit semantics", async () => { + fs.writeFileSync(path.join(tmpDir, "globals.d.ts"), [ + "declare const enum Level {", + " High = 2", + "}" + ].join("\n")); + fs.writeFileSync(path.join(tmpDir, "types.ts"), "export interface Widget { value: string }\n"); + const input = path.join(tmpDir, "entry.ts"); + fs.writeFileSync(input, [ + "/// ", + "export { Widget } from './types';", + "console.log(Level.High);" + ].join("\n")); + + const { code } = await ncc(input, { cache: false, quiet: true }); + const output = path.join(tmpDir, "output.js"); + fs.writeFileSync(output, code); + const runner = path.join(tmpDir, "runner.js"); + fs.writeFileSync(runner, [ + `const value = require(${JSON.stringify(output)});`, + "console.log('widget:' + ('Widget' in value));" + ].join("\n")); + const result = runNode(runner); + + expect(result.trim().split("\n")).toEqual(["2", "widget:false"]); + }); + + it("discovers and tracks a tsconfig outside the current working directory", async () => { + const sourceDir = path.join(tmpDir, "src"); + fs.mkdirSync(sourceDir); + const tsconfig = path.join(tmpDir, "tsconfig.json"); + fs.writeFileSync(tsconfig, JSON.stringify({ + compilerOptions: { + baseUrl: ".", + paths: { + "@value": ["src/value"] + } + } + })); + fs.writeFileSync(path.join(sourceDir, "value.ts"), "export default 'tsconfig-ok';\n"); + const input = path.join(sourceDir, "entry.ts"); + fs.writeFileSync(input, "import value from '@value'; console.log(value);\n"); + + let watchedFiles; + const previousProject = process.env.TS_NODE_PROJECT; + delete process.env.TS_NODE_PROJECT; + try { + const result = await runWatchedBuild( + input, + { transpileOnly: true }, + files => { + watchedFiles = new Set(files); + } + ); + const output = path.join(tmpDir, "output.js"); + fs.writeFileSync(output, result.code); + + expect(runNode(output).trim()).toBe("tsconfig-ok"); + expect(watchedFiles).toBeDefined(); + expect([...watchedFiles]).toContain(tsconfig); + } finally { + if (previousProject === undefined) { + delete process.env.TS_NODE_PROJECT; + } else { + process.env.TS_NODE_PROJECT = previousProject; + } + } + }); + + it("tries URL resolution options for bare relative assets", async () => { + const input = path.join(tmpDir, "entry.mjs"); + fs.writeFileSync(input, "export default new URL('asset.txt', import.meta.url);\n"); + fs.writeFileSync(path.join(tmpDir, "asset.txt"), "asset-ok\n"); + + const { assets } = await ncc(input, { cache: false, esm: true, quiet: true }); + + expect(Object.values(assets).some(asset => asset.source.toString() === "asset-ok\n")).toBe(true); + }); + + it("derives the paths whose creation would resolve a missed request", () => { + const context = path.join(tmpDir, "src"); + fs.mkdirSync(context); + + const relative = missingDependencyPaths("./later?query", context, [".js", ".ts"]); + expect(relative).toEqual(expect.arrayContaining([ + path.join(context, "later"), + path.join(context, "later.js"), + path.join(context, "later.ts") + ])); + + const bare = missingDependencyPaths("future-pkg/deep/file.js", context, [".js"]); + expect(bare).toContain(path.join(context, "node_modules")); + + const packageDir = path.join(tmpDir, "node_modules", "existing-package"); + fs.mkdirSync(packageDir, { recursive: true }); + fs.writeFileSync(path.join(packageDir, "package.json"), JSON.stringify({ + name: "existing-package", + exports: { + "./future": "./generated/future.js" + } + })); + expect(missingDependencyPaths("existing-package/future", context, [".js"])).toContain( + path.join(packageDir, "package.json") + ); + expect(missingDependencyPaths("existing-package/future", context, [".js"])).toContain( + path.join(packageDir, "generated") + ); + + // Registering a path under a directory that does not exist yet would make + // rspack watch a far ancestor recursively, so every path stops one segment + // past the deepest directory that exists. + for (const candidate of [...relative, ...bare]) + expect(fs.existsSync(path.dirname(candidate))).toBe(true); + + fs.writeFileSync(path.join(tmpDir, "package.json"), JSON.stringify({ + imports: { + "#future": "./generated/future.js", + "#external": "optional-dependency", + "#external-missing": "not-installed", + "#a*/very-long": "./short-prefix/*", + "#abcdef*": "./long-prefix/*" + } + })); + expect(missingDependencyPaths("#future", context, [".js"])).toContain( + path.join(tmpDir, "package.json") + ); + expect(missingDependencyPaths("#future", context, [".js"])).toContain( + path.join(tmpDir, "generated") + ); + const externalPackageDir = path.join( + tmpDir, + "node_modules", + "optional-dependency" + ); + fs.mkdirSync(externalPackageDir); + fs.writeFileSync(path.join(externalPackageDir, "package.json"), JSON.stringify({ + exports: "./generated/value.js" + })); + expect(missingDependencyPaths("#external", context, [".js"])).toContain( + path.join(externalPackageDir, "generated") + ); + expect(missingDependencyPaths("#external-missing", context, [".js"])).toContain( + path.join(tmpDir, "node_modules", "not-installed") + ); + const wildcardTargets = missingDependencyPaths( + "#abcdef-value/very-long", + context, + [".js"] + ); + expect(wildcardTargets).toContain(path.join(tmpDir, "short-prefix")); + expect(wildcardTargets).toContain(path.join(tmpDir, "long-prefix")); + expect(missingDependencyPaths("data:text/javascript,0", context, [".js"])).toEqual([]); + }); + + // "ncc run" links the nearest node_modules into its temporary output + // directory. Stopping that walk at resolve("/node_modules") hung on Windows + // whenever the input was on a different drive than the working directory, + // because resolve picks up the working directory's drive: walking up from the + // input reached the other drive's root and stayed there forever. + it("stops the node_modules walk at the root of a path on any platform", () => { + expect(nodeModulesCandidates("/tmp/ncc-review-abc", path.posix)).toEqual([ + "/tmp/ncc-review-abc/node_modules", + "/tmp/node_modules" + ]); + expect(nodeModulesCandidates("/", path.posix)).toEqual([]); + + expect(nodeModulesCandidates("C:\\Users\\runner\\AppData\\Local\\Temp\\x", path.win32)).toEqual([ + "C:\\Users\\runner\\AppData\\Local\\Temp\\x\\node_modules", + "C:\\Users\\runner\\AppData\\Local\\Temp\\node_modules", + "C:\\Users\\runner\\AppData\\Local\\node_modules", + "C:\\Users\\runner\\AppData\\node_modules", + "C:\\Users\\runner\\node_modules", + "C:\\Users\\node_modules" + ]); + expect(nodeModulesCandidates("C:\\", path.win32)).toEqual([]); + expect(nodeModulesCandidates("\\\\server\\share\\project", path.win32)).toEqual([ + "\\\\server\\share\\project\\node_modules" + ]); + expect(nodeModulesCandidates("\\\\server\\share", path.win32)).toEqual([]); + + expect(nodeModulesCandidates(tmpDir)).toContain(path.join(tmpDir, "node_modules")); + }); + + it("registers missing dependencies with the watcher for a rewritten request", async () => { + const input = path.join(tmpDir, "entry.js"); + fs.writeFileSync(input, "module.exports = require('./later');\n"); + + let watched; + await runWatchedBuild(input, {}, (_files, _dirs, missing) => { + watched = new Set(missing); + }); + + expect(watched).toBeDefined(); + expect([...watched]).toContain(path.join(tmpDir, "later.js")); + }); + + it("watches a package scope for a missing imports target", async () => { + fs.writeFileSync(path.join(tmpDir, "package.json"), JSON.stringify({ + type: "module", + imports: { + "#future": "./generated/future.js" + } + })); + const input = path.join(tmpDir, "entry.mjs"); + fs.writeFileSync(input, "import '#future';\n"); + + let watchedMissing; + await runWatchedBuild(input, { esm: true }, (_files, _dirs, missing) => { + watchedMissing = new Set(missing); + }); + + expect(watchedMissing).toBeDefined(); + expect([...watchedMissing]).toContain(path.join(tmpDir, "generated")); + }); + + it("does not ignore bundled node_modules changes in watch mode", async () => { + const packageDir = path.join(tmpDir, "node_modules", "watched-dependency"); + fs.mkdirSync(packageDir, { recursive: true }); + fs.writeFileSync(path.join(packageDir, "package.json"), JSON.stringify({ + name: "watched-dependency", + main: "index.js" + })); + fs.writeFileSync(path.join(packageDir, "index.js"), "module.exports = 1;\n"); + const input = path.join(tmpDir, "entry.js"); + fs.writeFileSync(input, "module.exports = require('watched-dependency');\n"); + + let watchOptions; + await runWatchedBuild(input, {}, (_files, _dirs, _missing, _startTime, options) => { + watchOptions = options; + }); + + expect(watchOptions).toBeDefined(); + expect(watchOptions.ignored).toEqual([]); + }); + + it("watches the TypeScript fallback for a missing .js request", async () => { + const input = path.join(tmpDir, "entry.ts"); + fs.writeFileSync(input, "require('./later.js');\n"); + + let watched; + await runWatchedBuild( + input, + { transpileOnly: true }, + (_files, _dirs, missing) => { + watched = new Set(missing); + } + ); + + expect(watched).toBeDefined(); + expect([...watched]).toContain(path.join(tmpDir, "later.ts")); + }); + + it("classifies known resolver misses without broad substring matching", () => { + expect(isResolverNotFoundError({ code: "MODULE_NOT_FOUND" })).toBe(true); + expect(isResolverNotFoundError({ name: "ModuleNotFoundError" })).toBe(true); + expect(isResolverNotFoundError({ message: 'RspackResolver(NotFound("./missing"))' })).toBe(true); + expect(isResolverNotFoundError({ message: 'RspackResolver(MatchedAliasNotFound("x"))' })).toBe(true); + expect(isResolverNotFoundError({ message: 'RspackResolver(ExtensionAlias("x"))' })).toBe(true); + expect(isResolverNotFoundError({ message: "RspackResolver(JsonError(\"bad package\"))" })).toBe(false); + expect(isResolverNotFoundError({ message: "NotFound appeared in unrelated text" })).toBe(false); + }); + + it("keeps the original compilation message when every line looks like a stack frame", () => { + expect(formatCompilationErrors([{ message: "at first\nat second" }])).toBe("at first\nat second"); + expect(formatCompilationErrors([{ message: "useful message\n at first" }])).toBe("useful message"); + }); + + it("passes JSON through before the relocator reads its uninitialized code variable", async () => { + const result = await new Promise((resolve, reject) => { + relocateLoader.call({ + resourcePath: path.join(tmpDir, "data.json"), + async() { + return (err, content, map) => err ? reject(err) : resolve({ content, map }); + } + }, Buffer.from('{"value":true}'), { version: 3 }); + }); + + expect(result).toEqual({ + content: '{"value":true}', + map: { version: 3 } + }); + }); + + it("reports a TypeScript config diagnostic once per compilation", async () => { + const errors = []; + const compilation = { + errors, + hooks: { + finishModules: { + tap() {} + } + } + }; + const load = resourcePath => new Promise((resolve, reject) => { + tsLoader.call({ + _compilation: compilation, + resourcePath, + sourceMap: false, + cacheable() {}, + getOptions() { + return { + compiler: require("typescript"), + compilerOptions: { target: "definitely-invalid" }, + configFileDirectory: tmpDir, + transpileOnly: true + }; + }, + async() { + return err => err ? reject(err) : resolve(); + }, + emitError(error) { + errors.push(error); + } + }, Buffer.from("export const value = 1;")); + }); + + await load(path.join(tmpDir, "a.ts")); + await load(path.join(tmpDir, "b.ts")); + + expect(errors).toHaveLength(1); + expect(errors[0].message).toContain("TS6046"); + }); + + it("reports TypeScript warnings without failing the compilation", async () => { + const finishModules = []; + const warnings = []; + const compilation = { + errors: [], + warnings, + hooks: { + finishModules: { + tap(_name, handler) { + finishModules.push(handler); + } + } + } + }; + const warning = { + category: 0, + code: 9999, + messageText: "warning only" + }; + const typescript = { + DiagnosticCategory: { Warning: 0, Error: 1 }, + sys: { newLine: "\n" }, + convertCompilerOptionsFromJson(options) { + return { options, errors: [] }; + }, + flattenDiagnosticMessageText(message) { + return String(message); + }, + formatDiagnostics(diagnostics) { + return diagnostics.map(diagnostic => diagnostic.messageText).join("\n"); + }, + createCompilerHost() { + return {}; + }, + createProgram() { + return { + getSourceFile(fileName) { + return { fileName }; + }, + emit(_sourceFile, writeFile) { + writeFile(path.join(tmpDir, "entry.js"), ""); + return { diagnostics: [warning] }; + } + }; + }, + getPreEmitDiagnostics() { + return [warning]; + } + }; + + await new Promise((resolve, reject) => { + tsLoader.call({ + _compilation: compilation, + resourcePath: path.join(tmpDir, "entry.ts"), + sourceMap: false, + cacheable() {}, + getOptions() { + return { + compiler: typescript, + compilerOptions: {}, + configFileDirectory: tmpDir + }; + }, + async() { + return err => err ? reject(err) : resolve(); + }, + emitError: reject, + emitWarning(error) { + warnings.push(error); + } + }, Buffer.from("export default 1;")); + }); + + finishModules[0](); + expect(compilation.errors).toHaveLength(0); + expect(warnings).toHaveLength(1); + expect(warnings[0].message).toContain("warning only"); + }); + + it("emits TypeScript declarations once from the shared program", async () => { + const finishModules = []; + const emitted = new Map(); + const compilation = { + errors: [], + emitAsset(name, source) { + emitted.set(name, source.source()); + }, + hooks: { + finishModules: { + tap(_name, handler) { + finishModules.push(handler); + } + } + } + }; + const resourcePath = path.join(tmpDir, "source.ts"); + fs.writeFileSync(resourcePath, "export function value(input: string): string { return input; }\n"); + + await new Promise((resolve, reject) => { + tsLoader.call({ + _compilation: compilation, + resourcePath, + sourceMap: false, + cacheable() {}, + getOptions() { + return { + compiler: require("typescript"), + compilerOptions: { + declaration: true, + declarationDir: path.join(tmpDir, "types"), + module: "esnext", + target: "esnext", + outDir: "//" + }, + configFileDirectory: tmpDir + }; + }, + async() { + return err => err ? reject(err) : resolve(); + }, + emitError: reject + }, Buffer.from(fs.readFileSync(resourcePath))); + }); + + expect(finishModules).toHaveLength(1); + finishModules[0](); + expect(emitted.get("source.d.ts")).toContain( + "export declare function value(input: string): string;" + ); + }); + + it("shares one TypeScript type-check program across source directories", async () => { + const finishModules = []; + const programs = []; + const compilation = { + errors: [], + hooks: { + finishModules: { + tap(_name, handler) { + finishModules.push(handler); + } + } + } + }; + const typescript = { + sys: { newLine: "\n" }, + convertCompilerOptionsFromJson(options, basePath) { + return { + options: { + ...options, + baseUrl: path.resolve(basePath, options.baseUrl) + }, + errors: [] + }; + }, + transpileModule() { + return { outputText: "", diagnostics: [] }; + }, + createCompilerHost() { + return {}; + }, + createProgram(files, options) { + programs.push({ files, options }); + return { + getSourceFile(fileName) { + return { fileName }; + }, + emit(sourceFile, writeFile) { + writeFile( + sourceFile.fileName.replace(/\.tsx?$/, ".js.map"), + JSON.stringify({ tag: "javascript" }) + ); + writeFile( + sourceFile.fileName.replace(/\.tsx?$/, ".d.ts.map"), + JSON.stringify({ tag: "declaration" }) + ); + writeFile(sourceFile.fileName.replace(/\.tsx?$/, ".js"), ""); + return { diagnostics: [] }; + } + }; + }, + getPreEmitDiagnostics() { + return []; + } + }; + const load = resourcePath => new Promise((resolve, reject) => { + tsLoader.call({ + _compilation: compilation, + resourcePath, + sourceMap: false, + cacheable() {}, + getOptions() { + return { + compiler: typescript, + compilerOptions: { baseUrl: "." }, + configFileDirectory: tmpDir + }; + }, + async() { + return (err, _output, map) => err ? reject(err) : resolve(map); + }, + emitError: reject + }, Buffer.from("export default 1;")); + }); + + const firstMap = await load(path.join(tmpDir, "src", "a.ts")); + const secondMap = await load(path.join(tmpDir, "src", "nested", "b.ts")); + + expect(finishModules).toHaveLength(1); + finishModules[0](); + expect(programs).toHaveLength(1); + expect(programs[0].files).toEqual([path.join(tmpDir, "src", "a.ts")]); + expect(firstMap.tag).toBe("javascript"); + expect(secondMap.tag).toBe("javascript"); + }); +}); diff --git a/test/unit/browser-mainfield/output-coverage.js b/test/unit/browser-mainfield/output-coverage.js index 8620e0ea5..1af673cbe 100644 --- a/test/unit/browser-mainfield/output-coverage.js +++ b/test/unit/browser-mainfield/output-coverage.js @@ -1,101 +1,89 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +854() { +console.log('browser file!!') -/***/ 854: -/***/ (() => { +}, -console.log('browser file!!') +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/***/ }) +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; __nccwpck_require__.r(__webpack_exports__); -/* harmony import */ var crypto_browser__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(854); -/* harmony import */ var crypto_browser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(crypto_browser__WEBPACK_IMPORTED_MODULE_0__); +/* import */ var crypto_browser__rspack_import_0 = __nccwpck_require__(854); +/* import */ var crypto_browser__rspack_import_0_default = /*#__PURE__*/__nccwpck_require__.n(crypto_browser__rspack_import_0); console.log('main file') })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/browser-mainfield/output.js b/test/unit/browser-mainfield/output.js index 6b3ae974f..c792b84a1 100644 --- a/test/unit/browser-mainfield/output.js +++ b/test/unit/browser-mainfield/output.js @@ -1,101 +1,89 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +336() { +console.log('browser file!!') -/***/ 267: -/***/ (() => { +}, -console.log('browser file!!') +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/***/ }) +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. (() => { "use strict"; __nccwpck_require__.r(__webpack_exports__); -/* harmony import */ var crypto_browser__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(267); -/* harmony import */ var crypto_browser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(crypto_browser__WEBPACK_IMPORTED_MODULE_0__); +/* import */ var crypto_browser__rspack_import_0 = __nccwpck_require__(336); +/* import */ var crypto_browser__rspack_import_0_default = /*#__PURE__*/__nccwpck_require__.n(crypto_browser__rspack_import_0); console.log('main file') })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/bundle-subasset/output-coverage.js b/test/unit/bundle-subasset/output-coverage.js index 29a67f08e..a794b42c3 100644 --- a/test/unit/bundle-subasset/output-coverage.js +++ b/test/unit/bundle-subasset/output-coverage.js @@ -1,95 +1,85 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ +(() => { +"use strict"; +var __webpack_modules__ = ({ +928(module) { +module.exports = require("path"); -/***/ 928: -/***/ ((module) => { +}, -module.exports = require("path"); +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { -/***/ }) +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; + +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { __nccwpck_require__.r(__webpack_exports__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(928); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* import */ var path__rspack_import_0 = __nccwpck_require__(928); +/* import */ var path__rspack_import_0_default = /*#__PURE__*/__nccwpck_require__.n(path__rspack_import_0); const file = __nccwpck_require__.ab + "pi-bridge.js"; @@ -100,6 +90,8 @@ const obscureRequire = eval(`function obscureRequire (file) { console.log(obscureRequire(__nccwpck_require__.ab + "pi-bridge.js")); +})(); + module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/bundle-subasset/output.js b/test/unit/bundle-subasset/output.js index 29a67f08e..e900bc352 100644 --- a/test/unit/bundle-subasset/output.js +++ b/test/unit/bundle-subasset/output.js @@ -1,95 +1,85 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ +(() => { +"use strict"; +var __webpack_modules__ = ({ +928(module) { +module.exports = require("path"); -/***/ 928: -/***/ ((module) => { +}, -module.exports = require("path"); +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { -/***/ }) +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; + +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { __nccwpck_require__.r(__webpack_exports__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(928); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* import */ var path__rspack_import_0 = __nccwpck_require__(928); +/* import */ var path__rspack_import_0_default = /*#__PURE__*/__nccwpck_require__.n(path__rspack_import_0); const file = __nccwpck_require__.ab + "pi-bridge.js"; @@ -100,6 +90,8 @@ const obscureRequire = eval(`function obscureRequire (file) { console.log(obscureRequire(__nccwpck_require__.ab + "pi-bridge.js")); +})(); + module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/bundle-subasset2/output-coverage.js b/test/unit/bundle-subasset2/output-coverage.js index 11bc32133..5851e3e2f 100644 --- a/test/unit/bundle-subasset2/output-coverage.js +++ b/test/unit/bundle-subasset2/output-coverage.js @@ -1,71 +1,63 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({}); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/************************************************************************/ +(() => { +"use strict"; +var __webpack_modules__ = ({}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; + +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); var __webpack_exports__ = {}; ;// CONCATENATED MODULE: external "piscina" @@ -85,5 +77,5 @@ const piscina = new (external_piscina_default())({ })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/bundle-subasset2/output.js b/test/unit/bundle-subasset2/output.js index 11bc32133..3099a723e 100644 --- a/test/unit/bundle-subasset2/output.js +++ b/test/unit/bundle-subasset2/output.js @@ -1,71 +1,63 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({}); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __nccwpck_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __nccwpck_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/************************************************************************/ +(() => { +"use strict"; +var __webpack_modules__ = ({}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/compat_get_default_export +(() => { +// getDefaultExport function for compatibility with non-ESM modules +__nccwpck_require__.n = (module) => { + var getter = module && module.__esModule ? + () => (module['default']) : + () => (module); + __nccwpck_require__.d(getter, { a: getter }); + return getter; +}; + +})(); +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); var __webpack_exports__ = {}; ;// CONCATENATED MODULE: external "piscina" @@ -85,5 +77,5 @@ const piscina = new (external_piscina_default())({ })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/custom-emit/output-coverage.js b/test/unit/custom-emit/output-coverage.js index 98b0f5119..4ee3521e7 100644 --- a/test/unit/custom-emit/output-coverage.js +++ b/test/unit/custom-emit/output-coverage.js @@ -1,56 +1,52 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 896: -/***/ ((module) => { - +(() => { +var __webpack_modules__ = ({ +896(module) { "use strict"; module.exports = require("fs"); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { const { readFileSync } = __nccwpck_require__(896); console.log(readFileSync(__dirname + './test.json')); +})(); + module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/custom-emit/output.js b/test/unit/custom-emit/output.js index 98b0f5119..cc14c0b85 100644 --- a/test/unit/custom-emit/output.js +++ b/test/unit/custom-emit/output.js @@ -1,56 +1,52 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 896: -/***/ ((module) => { - +(() => { +var __webpack_modules__ = ({ +896(module) { "use strict"; module.exports = require("fs"); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { const { readFileSync } = __nccwpck_require__(896); console.log(readFileSync(__dirname + './test.json')); +})(); + module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/double-nested-builds/output-coverage.js b/test/unit/double-nested-builds/output-coverage.js index 4b03cd0d3..4fe931e09 100644 --- a/test/unit/double-nested-builds/output-coverage.js +++ b/test/unit/double-nested-builds/output-coverage.js @@ -1,9 +1,6 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 447: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - +(() => { +var __webpack_modules__ = ({ +447(module, __unused_rspack_exports, __nccwpck_require__) { /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ @@ -99,10 +96,10 @@ /******/ if (typeof __nccwpck_require3_ !== 'undefined') __nccwpck_require3_.ab = __dirname + "/"; /******/ /************************************************************************/ - var __nested_webpack_exports__ = {}; + var __nested_rspack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { - __nccwpck_require3_.r(__nested_webpack_exports__); + __nccwpck_require3_.r(__nested_rspack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require3_(622); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require3_.n(path__WEBPACK_IMPORTED_MODULE_0__); @@ -117,7 +114,7 @@ })(); - module.exports = __nested_webpack_exports__; + module.exports = __nested_rspack_exports__; /******/ })() ; @@ -174,65 +171,55 @@ module.exports = __nccwpck_require__(928); /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __nested_webpack_exports__ = __nccwpck_require2_(332); -/******/ module.exports = __nested_webpack_exports__; +/******/ var __nested_rspack_exports__ = __nccwpck_require2_(332); +/******/ module.exports = __nested_rspack_exports__; /******/ /******/ })() ; -/***/ }), - -/***/ 928: -/***/ ((module) => { - +}, +928(module) { "use strict"; module.exports = require("path"); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(447); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +var __webpack_exports__ = __nccwpck_require__(447); +module.exports = __webpack_exports__; +})() ; \ No newline at end of file diff --git a/test/unit/double-nested-builds/output.js b/test/unit/double-nested-builds/output.js index c23557f56..53eba7062 100644 --- a/test/unit/double-nested-builds/output.js +++ b/test/unit/double-nested-builds/output.js @@ -1,9 +1,6 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 236: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - +(() => { +var __webpack_modules__ = ({ +33(module, __unused_rspack_exports, __nccwpck_require__) { /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ @@ -99,10 +96,10 @@ /******/ if (typeof __nccwpck_require3_ !== 'undefined') __nccwpck_require3_.ab = __dirname + "/"; /******/ /************************************************************************/ - var __nested_webpack_exports__ = {}; + var __nested_rspack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { - __nccwpck_require3_.r(__nested_webpack_exports__); + __nccwpck_require3_.r(__nested_rspack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require3_(622); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require3_.n(path__WEBPACK_IMPORTED_MODULE_0__); @@ -117,7 +114,7 @@ })(); - module.exports = __nested_webpack_exports__; + module.exports = __nested_rspack_exports__; /******/ })() ; @@ -174,65 +171,55 @@ module.exports = __nccwpck_require__(928); /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __nested_webpack_exports__ = __nccwpck_require2_(332); -/******/ module.exports = __nested_webpack_exports__; +/******/ var __nested_rspack_exports__ = __nccwpck_require2_(332); +/******/ module.exports = __nested_rspack_exports__; /******/ /******/ })() ; -/***/ }), - -/***/ 928: -/***/ ((module) => { - +}, +928(module) { "use strict"; module.exports = require("path"); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(236); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +var __webpack_exports__ = __nccwpck_require__(33); +module.exports = __webpack_exports__; +})() +; diff --git a/test/unit/exports-nomodule/output-coverage.js b/test/unit/exports-nomodule/output-coverage.js index 06ccd1cfb..0b3d0acd8 100644 --- a/test/unit/exports-nomodule/output-coverage.js +++ b/test/unit/exports-nomodule/output-coverage.js @@ -1,4 +1,4 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/exports-nomodule/node.js var x = 'x'; diff --git a/test/unit/exports-nomodule/output.js b/test/unit/exports-nomodule/output.js index 06ccd1cfb..65dfba4e2 100644 --- a/test/unit/exports-nomodule/output.js +++ b/test/unit/exports-nomodule/output.js @@ -1,8 +1,8 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/exports-nomodule/node.js var x = 'x'; ;// CONCATENATED MODULE: ./test/unit/exports-nomodule/input.js -console.log(x); \ No newline at end of file +console.log(x); diff --git a/test/unit/exports-wildcard/output-coverage.js b/test/unit/exports-wildcard/output-coverage.js index fb0042b62..d911796f0 100644 --- a/test/unit/exports-wildcard/output-coverage.js +++ b/test/unit/exports-wildcard/output-coverage.js @@ -1,4 +1,4 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/exports-wildcard/node.js var y = 'y'; diff --git a/test/unit/exports-wildcard/output.js b/test/unit/exports-wildcard/output.js index fb0042b62..18e6725eb 100644 --- a/test/unit/exports-wildcard/output.js +++ b/test/unit/exports-wildcard/output.js @@ -1,8 +1,8 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/exports-wildcard/node.js var y = 'y'; ;// CONCATENATED MODULE: ./test/unit/exports-wildcard/input.js -console.log(y); \ No newline at end of file +console.log(y); diff --git a/test/unit/externals/output-coverage.js b/test/unit/externals/output-coverage.js index 5eda1d50b..72b90412d 100644 --- a/test/unit/externals/output-coverage.js +++ b/test/unit/externals/output-coverage.js @@ -1,68 +1,56 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +708(module) { +"use strict"; +module.exports = require("external-replace/replaced/some-file"); -/***/ 708: -/***/ ((module) => { +}, +371(module) { +"use strict"; +module.exports = require("externalmapped"); +}, +689(module) { "use strict"; -module.exports = require("external-replace/replaced/some-file"); +module.exports = require("regexexternal"); -/***/ }), +}, -/***/ 371: -/***/ ((module) => { +}); +// The module cache +var __webpack_module_cache__ = {}; -"use strict"; -module.exports = require("externalmapped"); +// The require function +function __nccwpck_require__(moduleId) { -/***/ }), +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { -/***/ 689: -/***/ ((module) => { +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -"use strict"; -module.exports = require("regexexternal"); +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; -/***/ }) +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { const external = __nccwpck_require__(371); const regexpExternal = __nccwpck_require__(689); const regexpExternalMatch = __nccwpck_require__(708) @@ -71,6 +59,8 @@ console.log(external); console.log(regexpExternal); console.log(regexpExternalMatch); +})(); + module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/externals/output.js b/test/unit/externals/output.js index 5eda1d50b..6a0398072 100644 --- a/test/unit/externals/output.js +++ b/test/unit/externals/output.js @@ -1,68 +1,56 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +708(module) { +"use strict"; +module.exports = require("external-replace/replaced/some-file"); -/***/ 708: -/***/ ((module) => { +}, +371(module) { +"use strict"; +module.exports = require("externalmapped"); +}, +689(module) { "use strict"; -module.exports = require("external-replace/replaced/some-file"); +module.exports = require("regexexternal"); -/***/ }), +}, -/***/ 371: -/***/ ((module) => { +}); +// The module cache +var __webpack_module_cache__ = {}; -"use strict"; -module.exports = require("externalmapped"); +// The require function +function __nccwpck_require__(moduleId) { -/***/ }), +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { -/***/ 689: -/***/ ((module) => { +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -"use strict"; -module.exports = require("regexexternal"); +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; -/***/ }) +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { const external = __nccwpck_require__(371); const regexpExternal = __nccwpck_require__(689); const regexpExternalMatch = __nccwpck_require__(708) @@ -71,6 +59,8 @@ console.log(external); console.log(regexpExternal); console.log(regexpExternalMatch); +})(); + module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/import-meta-cjs/output-coverage.js b/test/unit/import-meta-cjs/output-coverage.js index 515c1f82b..03dbee8ae 100644 --- a/test/unit/import-meta-cjs/output-coverage.js +++ b/test/unit/import-meta-cjs/output-coverage.js @@ -1,6 +1,6 @@ -/******/ (() => { // webpackBootstrap -var __webpack_exports__ = {}; +(() => { +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; console.log(require("url").pathToFileURL(__filename).href); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/import-meta-cjs/output.js b/test/unit/import-meta-cjs/output.js index 515c1f82b..51560322d 100644 --- a/test/unit/import-meta-cjs/output.js +++ b/test/unit/import-meta-cjs/output.js @@ -1,6 +1,6 @@ -/******/ (() => { // webpackBootstrap -var __webpack_exports__ = {}; +(() => { +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; console.log(require("url").pathToFileURL(__filename).href); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/import-meta-esm/output-coverage.js b/test/unit/import-meta-esm/output-coverage.js index 7d40c64c5..2194f9f12 100644 --- a/test/unit/import-meta-esm/output-coverage.js +++ b/test/unit/import-meta-esm/output-coverage.js @@ -1,2 +1,2 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; console.log(import.meta.url); \ No newline at end of file diff --git a/test/unit/import-meta-esm/output.js b/test/unit/import-meta-esm/output.js index 7d40c64c5..8b5351f53 100644 --- a/test/unit/import-meta-esm/output.js +++ b/test/unit/import-meta-esm/output.js @@ -1,2 +1,2 @@ -var __webpack_exports__ = {}; -console.log(import.meta.url); \ No newline at end of file +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; +console.log(import.meta.url); diff --git a/test/unit/imports/output-coverage.js b/test/unit/imports/output-coverage.js index 1890d7f86..e8f4c480f 100644 --- a/test/unit/imports/output-coverage.js +++ b/test/unit/imports/output-coverage.js @@ -1,4 +1,4 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/imports/node.js var x = 'x'; diff --git a/test/unit/imports/output.js b/test/unit/imports/output.js index 1890d7f86..3f4cba56c 100644 --- a/test/unit/imports/output.js +++ b/test/unit/imports/output.js @@ -1,8 +1,8 @@ -var __webpack_exports__ = {}; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = decodeURIComponent(new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1)) + "/";var __webpack_exports__ = {}; ;// CONCATENATED MODULE: ./test/unit/imports/node.js var x = 'x'; ;// CONCATENATED MODULE: ./test/unit/imports/input.js -console.log(x); \ No newline at end of file +console.log(x); diff --git a/test/unit/minify-err/output-coverage.js b/test/unit/minify-err/output-coverage.js index ee7b38487..8c6c76a96 100644 --- a/test/unit/minify-err/output-coverage.js +++ b/test/unit/minify-err/output-coverage.js @@ -1 +1 @@ -(()=>{var __webpack_modules__={896:_=>{"use strict";_.exports=require("fs")}};var __webpack_module_cache__={};function __nccwpck_require__(_){var e=__webpack_module_cache__[_];if(e!==undefined){return e.exports}var r=__webpack_module_cache__[_]={exports:{}};var a=true;try{__webpack_modules__[_](r,r.exports,__nccwpck_require__);a=false}finally{if(a)delete __webpack_module_cache__[_]}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__={};var input_require;if(global.GENTLY)input_require=GENTLY.hijack(eval("require"));console.log(__nccwpck_require__(896));module.exports=__webpack_exports__})(); \ No newline at end of file +(()=>{var __webpack_modules__={896(_){"use strict";_.exports=require("fs")}};var __webpack_module_cache__={};function __nccwpck_require__(_){var e=__webpack_module_cache__[_];if(e!==undefined){return e.exports}var r=__webpack_module_cache__[_]={exports:{}};try{__webpack_modules__[_](r,r.exports,__nccwpck_require__)}catch(e){delete __webpack_module_cache__[_];throw e}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__={};(()=>{var require;if(global.GENTLY)require=GENTLY.hijack(eval("require"));console.log(__nccwpck_require__(896))})();module.exports=__webpack_exports__})(); \ No newline at end of file diff --git a/test/unit/minify-err/output.js b/test/unit/minify-err/output.js index ee7b38487..a073ea325 100644 --- a/test/unit/minify-err/output.js +++ b/test/unit/minify-err/output.js @@ -1 +1 @@ -(()=>{var __webpack_modules__={896:_=>{"use strict";_.exports=require("fs")}};var __webpack_module_cache__={};function __nccwpck_require__(_){var e=__webpack_module_cache__[_];if(e!==undefined){return e.exports}var r=__webpack_module_cache__[_]={exports:{}};var a=true;try{__webpack_modules__[_](r,r.exports,__nccwpck_require__);a=false}finally{if(a)delete __webpack_module_cache__[_]}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__={};var input_require;if(global.GENTLY)input_require=GENTLY.hijack(eval("require"));console.log(__nccwpck_require__(896));module.exports=__webpack_exports__})(); \ No newline at end of file +(()=>{var __webpack_modules__={896(_){"use strict";_.exports=require("fs")}};var __webpack_module_cache__={};function __nccwpck_require__(_){var e=__webpack_module_cache__[_];if(e!==undefined){return e.exports}var r=__webpack_module_cache__[_]={exports:{}};try{__webpack_modules__[_](r,r.exports,__nccwpck_require__)}catch(e){delete __webpack_module_cache__[_];throw e}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__={};(()=>{var require;if(global.GENTLY)require=GENTLY.hijack(eval("require"));console.log(__nccwpck_require__(896))})();module.exports=__webpack_exports__})(); diff --git a/test/unit/minify-sourcemap-register/output-coverage.js b/test/unit/minify-sourcemap-register/output-coverage.js index dad438f87..65224c34d 100644 --- a/test/unit/minify-sourcemap-register/output-coverage.js +++ b/test/unit/minify-sourcemap-register/output-coverage.js @@ -1,2 +1,2 @@ -require('./sourcemap-register.js');(()=>{var o={};(()=>{var l=o;const e="qux";console.log?.("hello");l.foobar=e})();module.exports=o})(); +require('./sourcemap-register.js');(()=>{if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};(()=>{var _=e;const o="qux";console.log?.("hello");_.foobar=o})();module.exports=e})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/unit/minify-sourcemap-register/output-coverage.js.map b/test/unit/minify-sourcemap-register/output-coverage.js.map index 10fb0e2ab..658627fd7 100644 --- a/test/unit/minify-sourcemap-register/output-coverage.js.map +++ b/test/unit/minify-sourcemap-register/output-coverage.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file diff --git a/test/unit/minify-sourcemap-register/output.js b/test/unit/minify-sourcemap-register/output.js index dad438f87..65224c34d 100644 --- a/test/unit/minify-sourcemap-register/output.js +++ b/test/unit/minify-sourcemap-register/output.js @@ -1,2 +1,2 @@ -require('./sourcemap-register.js');(()=>{var o={};(()=>{var l=o;const e="qux";console.log?.("hello");l.foobar=e})();module.exports=o})(); +require('./sourcemap-register.js');(()=>{if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};(()=>{var _=e;const o="qux";console.log?.("hello");_.foobar=o})();module.exports=e})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/unit/minify-sourcemap-register/output.js.map b/test/unit/minify-sourcemap-register/output.js.map index 10fb0e2ab..e75b513a7 100644 --- a/test/unit/minify-sourcemap-register/output.js.map +++ b/test/unit/minify-sourcemap-register/output.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} diff --git a/test/unit/minify-v8cache-sourcemap-register/output-coverage.js.map b/test/unit/minify-v8cache-sourcemap-register/output-coverage.js.map index 82b988d92..2eecb6025 100644 --- a/test/unit/minify-v8cache-sourcemap-register/output-coverage.js.map +++ b/test/unit/minify-v8cache-sourcemap-register/output-coverage.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-v8cache-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,IAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-v8cache-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,IAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file diff --git a/test/unit/minify-v8cache-sourcemap-register/output.js.map b/test/unit/minify-v8cache-sourcemap-register/output.js.map index 82b988d92..553e33b08 100644 --- a/test/unit/minify-v8cache-sourcemap-register/output.js.map +++ b/test/unit/minify-v8cache-sourcemap-register/output.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-v8cache-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,IAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify-v8cache-sourcemap-register/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,IAAA,SACAC,EAAAH,Q","ignoreList":[]} diff --git a/test/unit/minify/output-coverage.js b/test/unit/minify/output-coverage.js index 52345a5c4..8601cc795 100644 --- a/test/unit/minify/output-coverage.js +++ b/test/unit/minify/output-coverage.js @@ -1,2 +1,2 @@ -(()=>{var o={};(()=>{var l=o;const e="qux";console.log?.("hello");l.foobar=e})();module.exports=o})(); +(()=>{if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};(()=>{var _=e;const o="qux";console.log?.("hello");_.foobar=o})();module.exports=e})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/unit/minify/output-coverage.js.map b/test/unit/minify/output-coverage.js.map index 60b3b1e67..3c994fe74 100644 --- a/test/unit/minify/output-coverage.js.map +++ b/test/unit/minify/output-coverage.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file diff --git a/test/unit/minify/output.js b/test/unit/minify/output.js index 52345a5c4..8601cc795 100644 --- a/test/unit/minify/output.js +++ b/test/unit/minify/output.js @@ -1,2 +1,2 @@ -(()=>{var o={};(()=>{var l=o;const e="qux";console.log?.("hello");l.foobar=e})();module.exports=o})(); +(()=>{if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};(()=>{var _=e;const o="qux";console.log?.("hello");_.foobar=o})();module.exports=e})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/unit/minify/output.js.map b/test/unit/minify/output.js.map index 60b3b1e67..7509adbf6 100644 --- a/test/unit/minify/output.js.map +++ b/test/unit/minify/output.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"6BAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} \ No newline at end of file +{"version":3,"file":"index.js","names":["foobar","console","log","exports"],"sources":["../test/unit/minify/input.js"],"sourcesContent":["const foobar = 'qux'\nconsole.log?.(\"hello\");\nexports.foobar = foobar\n"],"mappings":"8GAAA,MAAAA,EAAA,MACAC,QAAAC,MAAA,SACAC,EAAAH,Q","ignoreList":[]} diff --git a/test/unit/nested-builds/output-coverage.js b/test/unit/nested-builds/output-coverage.js index 3b561f225..ddd7bd700 100644 --- a/test/unit/nested-builds/output-coverage.js +++ b/test/unit/nested-builds/output-coverage.js @@ -1,9 +1,6 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 695: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - +(() => { +var __webpack_modules__ = ({ +695(module, __unused_rspack_exports, __nccwpck_require__) { /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ @@ -93,10 +90,10 @@ /******/ if (typeof __nccwpck_require2_ !== 'undefined') __nccwpck_require2_.ab = __dirname + "/"; /******/ /************************************************************************/ - var __nested_webpack_exports__ = {}; + var __nested_rspack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { - __nccwpck_require2_.r(__nested_webpack_exports__); + __nccwpck_require2_.r(__nested_rspack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require2_(622); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require2_.n(path__WEBPACK_IMPORTED_MODULE_0__); @@ -111,64 +108,54 @@ })(); - module.exports = __nested_webpack_exports__; + module.exports = __nested_rspack_exports__; /******/ })() ; -/***/ }), - -/***/ 928: -/***/ ((module) => { - +}, +928(module) { "use strict"; module.exports = require("path"); -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(695); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +var __webpack_exports__ = __nccwpck_require__(695); +module.exports = __webpack_exports__; +})() ; \ No newline at end of file diff --git a/test/unit/nested-builds/output.js b/test/unit/nested-builds/output.js index f164abd72..6ff98bbb6 100644 --- a/test/unit/nested-builds/output.js +++ b/test/unit/nested-builds/output.js @@ -1,9 +1,6 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 494: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - +(() => { +var __webpack_modules__ = ({ +413(module, __unused_rspack_exports, __nccwpck_require__) { /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ @@ -93,10 +90,10 @@ /******/ if (typeof __nccwpck_require2_ !== 'undefined') __nccwpck_require2_.ab = __dirname + "/"; /******/ /************************************************************************/ - var __nested_webpack_exports__ = {}; + var __nested_rspack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { - __nccwpck_require2_.r(__nested_webpack_exports__); + __nccwpck_require2_.r(__nested_rspack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require2_(622); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require2_.n(path__WEBPACK_IMPORTED_MODULE_0__); @@ -111,64 +108,54 @@ })(); - module.exports = __nested_webpack_exports__; + module.exports = __nested_rspack_exports__; /******/ })() ; -/***/ }), - -/***/ 928: -/***/ ((module) => { - +}, +928(module) { "use strict"; module.exports = require("path"); -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __nccwpck_require__(494); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +var __webpack_exports__ = __nccwpck_require__(413); +module.exports = __webpack_exports__; +})() +; diff --git a/test/unit/runtime-notfound/output-coverage.js b/test/unit/runtime-notfound/output-coverage.js index 3c765573d..32bd4e0f9 100644 --- a/test/unit/runtime-notfound/output-coverage.js +++ b/test/unit/runtime-notfound/output-coverage.js @@ -1,62 +1,55 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +580(module) { +module.exports = eval("require")("./not-foud2.js"); -/***/ 580: -/***/ ((module) => { -module.exports = eval("require")("./not-foud2.js"); +}, +704(module) { +module.exports = eval("require")("./not-found.js"); -/***/ }), +}, -/***/ 704: -/***/ ((module) => { +}); +// The module cache +var __webpack_module_cache__ = {}; -module.exports = eval("require")("./not-found.js"); +// The require function +function __nccwpck_require__(moduleId) { +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { __nccwpck_require__(704); __nccwpck_require__(580); +})(); + module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/runtime-notfound/output.js b/test/unit/runtime-notfound/output.js index 2caca3c6e..1bb9667fc 100644 --- a/test/unit/runtime-notfound/output.js +++ b/test/unit/runtime-notfound/output.js @@ -1,62 +1,55 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +727(module) { +module.exports = eval("require")("./not-foud2.js"); -/***/ 643: -/***/ ((module) => { -module.exports = eval("require")("./not-foud2.js"); +}, +207(module) { +module.exports = eval("require")("./not-found.js"); -/***/ }), +}, -/***/ 875: -/***/ ((module) => { +}); +// The module cache +var __webpack_module_cache__ = {}; -module.exports = eval("require")("./not-found.js"); +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { +__nccwpck_require__(207); +__nccwpck_require__(727); +})(); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -__nccwpck_require__(875); -__nccwpck_require__(643); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/shebang/output-coverage.js b/test/unit/shebang/output-coverage.js index 6cfbb8f58..3d2cbb837 100644 --- a/test/unit/shebang/output-coverage.js +++ b/test/unit/shebang/output-coverage.js @@ -1,53 +1,46 @@ #!/bin/user/env node -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +272(module) { +module.exports = 'asdf'; -/***/ 272: -/***/ ((module) => { +}, -module.exports = 'asdf'; +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // 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__ = __nccwpck_require__(272); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() +// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = __nccwpck_require__(272); +module.exports = __webpack_exports__; +})() ; \ No newline at end of file diff --git a/test/unit/shebang/output.js b/test/unit/shebang/output.js index 11a1d2b50..c30ddeeaa 100644 --- a/test/unit/shebang/output.js +++ b/test/unit/shebang/output.js @@ -1,53 +1,47 @@ #!/bin/user/env node -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +(() => { +var __webpack_modules__ = ({ +446(module) { +//#!/bin/user/env node +module.exports = 'asdf'; -/***/ 321: -/***/ ((module) => { +}, -module.exports = 'asdf'; +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // 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__ = __nccwpck_require__(321); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file +// startup +// Load entry module and return exports +// This entry module is referenced by other modules so it can't be inlined +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = __nccwpck_require__(446); +module.exports = __webpack_exports__; +})() +; diff --git a/test/unit/ts-decl-dir/output-coverage.js b/test/unit/ts-decl-dir/output-coverage.js index d3fc31423..a1d780d97 100644 --- a/test/unit/ts-decl-dir/output-coverage.js +++ b/test/unit/ts-decl-dir/output-coverage.js @@ -1,39 +1,33 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +(() => { +"use strict"; +// The require scope +var __nccwpck_require__ = {}; + +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; // ESM COMPAT FLAG __nccwpck_require__.r(__webpack_exports__); @@ -51,5 +45,5 @@ function test(arg) { module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-decl-dir/output.js b/test/unit/ts-decl-dir/output.js index d3fc31423..4265039e0 100644 --- a/test/unit/ts-decl-dir/output.js +++ b/test/unit/ts-decl-dir/output.js @@ -1,39 +1,33 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +(() => { +"use strict"; +// The require scope +var __nccwpck_require__ = {}; + +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; // ESM COMPAT FLAG __nccwpck_require__.r(__webpack_exports__); @@ -51,5 +45,5 @@ function test(arg) { module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/ts-decl/output-coverage.js b/test/unit/ts-decl/output-coverage.js index c406d5dde..81b507a4f 100644 --- a/test/unit/ts-decl/output-coverage.js +++ b/test/unit/ts-decl/output-coverage.js @@ -1,39 +1,33 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +(() => { +"use strict"; +// The require scope +var __nccwpck_require__ = {}; + +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; // ESM COMPAT FLAG __nccwpck_require__.r(__webpack_exports__); @@ -51,5 +45,5 @@ function test(arg) { module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-decl/output.js b/test/unit/ts-decl/output.js index c406d5dde..ae35abdb3 100644 --- a/test/unit/ts-decl/output.js +++ b/test/unit/ts-decl/output.js @@ -1,39 +1,33 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ // The require scope -/******/ var __nccwpck_require__ = {}; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; +(() => { +"use strict"; +// The require scope +var __nccwpck_require__ = {}; + +// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; // ESM COMPAT FLAG __nccwpck_require__.r(__webpack_exports__); @@ -51,5 +45,5 @@ function test(arg) { module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/ts-exts/output-coverage.js b/test/unit/ts-exts/output-coverage.js index b762ad9c0..478b21f46 100644 --- a/test/unit/ts-exts/output-coverage.js +++ b/test/unit/ts-exts/output-coverage.js @@ -1,20 +1,14 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 585: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +585(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = {}; -/***/ }), - -/***/ 733: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - +}, +733(__unused_rspack_module, exports, __nccwpck_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; @@ -22,47 +16,42 @@ var dep_dep_js_1 = __nccwpck_require__(585); Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return dep_dep_js_1.default; } })); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -73,5 +62,5 @@ console.log(dep_js_1.default); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-exts/output.js b/test/unit/ts-exts/output.js index 0de645327..44aaa50ca 100644 --- a/test/unit/ts-exts/output.js +++ b/test/unit/ts-exts/output.js @@ -1,77 +1,66 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 344: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +165(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = {}; -/***/ }), - -/***/ 300: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - +}, +593(__unused_rspack_module, exports, __nccwpck_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; -var dep_dep_js_1 = __nccwpck_require__(344); +var dep_dep_js_1 = __nccwpck_require__(165); Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return dep_dep_js_1.default; } })); -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const dep_js_1 = __nccwpck_require__(300); +const dep_js_1 = __nccwpck_require__(593); console.log(dep_js_1.default); })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/ts-json-resolve/output-coverage.js b/test/unit/ts-json-resolve/output-coverage.js index 95c4800d9..49b6a54ce 100644 --- a/test/unit/ts-json-resolve/output-coverage.js +++ b/test/unit/ts-json-resolve/output-coverage.js @@ -1,10 +1,7 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 990: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +990(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.greet = greet; @@ -13,47 +10,42 @@ function greet() { } -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -64,5 +56,5 @@ console.log((0, dep_1.greet)()); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-json-resolve/output.js b/test/unit/ts-json-resolve/output.js index 2efd21e3f..f393e687b 100644 --- a/test/unit/ts-json-resolve/output.js +++ b/test/unit/ts-json-resolve/output.js @@ -1,10 +1,7 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 827: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +770(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.greet = greet; @@ -13,56 +10,51 @@ function greet() { } -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const dep_1 = __nccwpck_require__(827); +const dep_1 = __nccwpck_require__(770); console.log((0, dep_1.greet)()); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/output-coverage.js b/test/unit/ts-mixed-modules/output-coverage.js index 1ddb6da73..455e3c0bf 100644 --- a/test/unit/ts-mixed-modules/output-coverage.js +++ b/test/unit/ts-mixed-modules/output-coverage.js @@ -1,10 +1,7 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 475: -/***/ ((module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +475(module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); const config = { @@ -13,47 +10,43 @@ const config = { module.exports = config; -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // 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__ = __nccwpck_require__(475); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// 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 +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = __nccwpck_require__(475); +module.exports = __webpack_exports__; +})() ; \ No newline at end of file diff --git a/test/unit/ts-mixed-modules/output.js b/test/unit/ts-mixed-modules/output.js index 6c2de9550..95cf14398 100644 --- a/test/unit/ts-mixed-modules/output.js +++ b/test/unit/ts-mixed-modules/output.js @@ -1,10 +1,7 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 240: -/***/ ((module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +271(module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); const config = { @@ -13,47 +10,43 @@ const config = { module.exports = config; -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // 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__ = __nccwpck_require__(240); -/******/ module.exports = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// 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 +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = __nccwpck_require__(271); +module.exports = __webpack_exports__; +})() +; diff --git a/test/unit/ts-target-es2018/output-coverage.js b/test/unit/ts-target-es2018/output-coverage.js index f88ee9a78..fe8250c19 100644 --- a/test/unit/ts-target-es2018/output-coverage.js +++ b/test/unit/ts-target-es2018/output-coverage.js @@ -1,11 +1,11 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -var __webpack_exports__ = {}; +(() => { +"use strict"; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; if (process === null || process === void 0 ? void 0 : process.env.FOO) { console.log('foo'); } module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/ts-target-es2018/output.js b/test/unit/ts-target-es2018/output.js index f88ee9a78..28a4cf363 100644 --- a/test/unit/ts-target-es2018/output.js +++ b/test/unit/ts-target-es2018/output.js @@ -1,11 +1,11 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -var __webpack_exports__ = {}; +(() => { +"use strict"; +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; if (process === null || process === void 0 ? void 0 : process.env.FOO) { console.log('foo'); } module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/tsconfig-paths-allowjs/output-coverage.js b/test/unit/tsconfig-paths-allowjs/output-coverage.js index 641bbed51..75789be86 100644 --- a/test/unit/tsconfig-paths-allowjs/output-coverage.js +++ b/test/unit/tsconfig-paths-allowjs/output-coverage.js @@ -1,86 +1,74 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ +(() => { +"use strict"; +var __webpack_modules__ = ({ +33(__unused_rspack_module, __webpack_exports__, __nccwpck_require__) { +__nccwpck_require__.r(__webpack_exports__); +__nccwpck_require__.d(__webpack_exports__, { + "default": () => (__rspack_default_export) +}); +/* export default */ const __rspack_default_export = ({}); -/***/ 33: -/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => { -__nccwpck_require__.r(__webpack_exports__); -/* harmony export */ __nccwpck_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({}); +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; -/***/ }) +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -91,5 +79,5 @@ console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/tsconfig-paths-allowjs/output.js b/test/unit/tsconfig-paths-allowjs/output.js index d51962f32..73c7a73b4 100644 --- a/test/unit/tsconfig-paths-allowjs/output.js +++ b/test/unit/tsconfig-paths-allowjs/output.js @@ -1,63 +1,83 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 651: -/***/ ((module) => { - -module.exports = eval("require")("@module"); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. (() => { "use strict"; +var __webpack_modules__ = ({ +739(__unused_rspack_module, __webpack_exports__, __nccwpck_require__) { +__nccwpck_require__.r(__webpack_exports__); +__nccwpck_require__.d(__webpack_exports__, { + "default": () => (__rspack_default_export) +}); +/* export default */ const __rspack_default_export = ({}); + + +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const _module_1 = __nccwpck_require__(651); +const _module_1 = __nccwpck_require__(739); console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/tsconfig-paths-array-extends/output-coverage.js b/test/unit/tsconfig-paths-array-extends/output-coverage.js index af5d7edac..ee75c4239 100644 --- a/test/unit/tsconfig-paths-array-extends/output-coverage.js +++ b/test/unit/tsconfig-paths-array-extends/output-coverage.js @@ -1,86 +1,74 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ +(() => { +"use strict"; +var __webpack_modules__ = ({ +424(__unused_rspack_module, __webpack_exports__, __nccwpck_require__) { +__nccwpck_require__.r(__webpack_exports__); +__nccwpck_require__.d(__webpack_exports__, { + "default": () => (__rspack_default_export) +}); +/* export default */ const __rspack_default_export = ({}); -/***/ 424: -/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => { -__nccwpck_require__.r(__webpack_exports__); -/* harmony export */ __nccwpck_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({}); +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; -/***/ }) +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __nccwpck_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __nccwpck_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -91,5 +79,5 @@ console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/tsconfig-paths-array-extends/output.js b/test/unit/tsconfig-paths-array-extends/output.js index d51962f32..cbcae7d03 100644 --- a/test/unit/tsconfig-paths-array-extends/output.js +++ b/test/unit/tsconfig-paths-array-extends/output.js @@ -1,63 +1,83 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 651: -/***/ ((module) => { - -module.exports = eval("require")("@module"); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. (() => { "use strict"; +var __webpack_modules__ = ({ +618(__unused_rspack_module, __webpack_exports__, __nccwpck_require__) { +__nccwpck_require__.r(__webpack_exports__); +__nccwpck_require__.d(__webpack_exports__, { + "default": () => (__rspack_default_export) +}); +/* export default */ const __rspack_default_export = ({}); + + +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";// webpack/runtime/define_property_getters +(() => { +__nccwpck_require__.d = (exports, definition) => { + for(var key in definition) { + if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { + Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); + } + } +}; +})(); +// webpack/runtime/has_own_property +(() => { +__nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +})(); +// webpack/runtime/make_namespace_object +(() => { +// define __esModule on exports +__nccwpck_require__.r = (exports) => { + if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + } + Object.defineProperty(exports, '__esModule', { value: true }); +}; +})(); +var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const _module_1 = __nccwpck_require__(651); +const _module_1 = __nccwpck_require__(618); console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js index e643859cb..b5302be73 100644 --- a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js +++ b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js @@ -1,56 +1,48 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 747: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +747(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = {}; -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -61,5 +53,5 @@ console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/tsconfig-paths-conflicting-external/output.js b/test/unit/tsconfig-paths-conflicting-external/output.js index d51962f32..138a990c4 100644 --- a/test/unit/tsconfig-paths-conflicting-external/output.js +++ b/test/unit/tsconfig-paths-conflicting-external/output.js @@ -1,63 +1,57 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 651: -/***/ ((module) => { - -module.exports = eval("require")("@module"); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. (() => { "use strict"; +var __webpack_modules__ = ({ +343(__unused_rspack_module, exports) { + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports["default"] = {}; + + +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const _module_1 = __nccwpck_require__(651); +const _module_1 = __nccwpck_require__(343); console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +; diff --git a/test/unit/tsconfig-paths/output-coverage.js b/test/unit/tsconfig-paths/output-coverage.js index 79691f6f5..c6550f378 100644 --- a/test/unit/tsconfig-paths/output-coverage.js +++ b/test/unit/tsconfig-paths/output-coverage.js @@ -1,56 +1,48 @@ -/******/ (() => { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ 584: -/***/ ((__unused_webpack_module, exports) => { - +(() => { +"use strict"; +var __webpack_modules__ = ({ +584(__unused_rspack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = {}; -/***/ }) +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports). +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { var exports = __webpack_exports__; @@ -61,5 +53,5 @@ console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() +})() ; \ No newline at end of file diff --git a/test/unit/tsconfig-paths/output.js b/test/unit/tsconfig-paths/output.js index d51962f32..0bfbab087 100644 --- a/test/unit/tsconfig-paths/output.js +++ b/test/unit/tsconfig-paths/output.js @@ -1,63 +1,57 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 651: -/***/ ((module) => { - -module.exports = eval("require")("@module"); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __nccwpck_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 -/******/ var threw = true; -/******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete __webpack_module_cache__[moduleId]; -/******/ } -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/asset-relocator-loader */ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. (() => { "use strict"; +var __webpack_modules__ = ({ +372(__unused_rspack_module, exports) { + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports["default"] = {}; + + +}, + +}); +// The module cache +var __webpack_module_cache__ = {}; + +// The require function +function __nccwpck_require__(moduleId) { + +// Check if module is in cache +var cachedModule = __webpack_module_cache__[moduleId]; +if (cachedModule !== undefined) { +// ncc retries failed CommonJS modules on the next require. +return cachedModule.exports; +} +// Create a new module (and put it into the cache) +var module = (__webpack_module_cache__[moduleId] = { +exports: {} +}); +// Execute the module function +try { + +__webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); + +} catch (e) { +delete __webpack_module_cache__[moduleId]; +throw e; +} +// Return the exports of the module +return module.exports; + +} + +// asset-relocator-loader +if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";var __webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +(() => { var exports = __webpack_exports__; Object.defineProperty(exports, "__esModule", ({ value: true })); -const _module_1 = __nccwpck_require__(651); +const _module_1 = __nccwpck_require__(372); console.log(_module_1.default); })(); module.exports = __webpack_exports__; -/******/ })() -; \ No newline at end of file +})() +;