From db86c0f9a2a36aca8da9fb0825bd67e3cac91557 Mon Sep 17 00:00:00 2001 From: Hana Date: Tue, 24 Oct 2023 20:47:53 +0800 Subject: [PATCH 1/5] feat: pass loader test `option` --- packages/rspack/package.json | 2 + packages/rspack/src/loader-runner/index.ts | 47 +++++++++++++++++-- pnpm-lock.yaml | 32 +++++-------- .../loaders/coffee-loader/test.filter.js | 1 - .../loaders/options/deprecations.js | 14 +++--- .../configCases/loaders/options/errors.js | 20 ++++---- .../configCases/loaders/options/index.js | 10 ++-- .../loaders/options/test.filter.js | 1 - 8 files changed, 79 insertions(+), 48 deletions(-) delete mode 100644 webpack-test/configCases/loaders/options/test.filter.js diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 9be975cf736..7b8bc3b05da 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -63,7 +63,9 @@ "compare-versions": "6.0.0-rc.1", "enhanced-resolve": "5.12.0", "graceful-fs": "4.2.10", + "json-parse-even-better-errors": "^3.0.0", "neo-async": "2.6.2", + "querystring": "^0.2.1", "react-refresh": "0.14.0", "schema-utils": "^4.0.0", "tapable": "2.2.1", diff --git a/packages/rspack/src/loader-runner/index.ts b/packages/rspack/src/loader-runner/index.ts index 51d1db02eeb..2ec6ec2df5e 100644 --- a/packages/rspack/src/loader-runner/index.ts +++ b/packages/rspack/src/loader-runner/index.ts @@ -182,9 +182,34 @@ export async function runLoaders( const buildDependencies: string[] = rawContext.buildDependencies.slice(); const assetFilenames = rawContext.assetFilenames.slice(); - const loaders = rawContext.currentLoader - .split("$") - .map(loader => createLoaderObject(loader, compiler)); + const loaders = rawContext.currentLoader.split("$").map(loader => { + const splittedRequest = parsePathQueryFragment(loader); + const obj: any = {}; + obj.loader = obj.path = splittedRequest.path; + obj.query = splittedRequest.query; + obj.fragment = splittedRequest.fragment; + const type = /\.mjs$/i.test(splittedRequest.path) ? "module" : "commonjs"; + obj.type = type; + obj.options = splittedRequest.query + ? splittedRequest.query.slice(1) + : undefined; + if (typeof obj.options === "string" && obj.options[0] === "?") { + const ident = obj.options.slice(1); + if (ident === "[[missing ident]]") { + throw new Error( + "No ident is provided by referenced loader. " + + "When using a function for Rule.use in config you need to " + + "provide an 'ident' property for referenced loader options." + ); + } + obj.options = compiler.ruleSet.references.get(ident); + if (obj.options === undefined) { + throw new Error("Invalid ident is provided by referenced loader"); + } + obj.ident = ident; + } + return createLoaderObject(obj, compiler); + }); loaderContext.__internal__context = rawContext; loaderContext.context = contextDirectory; @@ -504,6 +529,22 @@ export async function runLoaders( const loader = getCurrentLoader(loaderContext); let options = loader?.options; + if (typeof options === "string") { + if (options.startsWith("{") && options.endsWith("}")) { + try { + const parseJson = require("json-parse-even-better-errors"); + options = parseJson(options); + } catch (e: any) { + throw new Error(`Cannot parse string options: ${e.message}`); + } + } else { + const querystring = require("querystring"); + options = querystring.parse(options, "&", "=", { + maxKeys: 0 + }); + } + } + if (options === null || options === undefined) { options = {}; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af781c72b51..fa247e4e401 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -989,12 +989,14 @@ importers: html-loader: ^4.2.0 html-webpack-plugin: ^5.5.0 jest-serializer-path: ^0.1.15 + json-parse-even-better-errors: ^3.0.0 less: 4.1.3 less-loader: ^11.1.0 neo-async: 2.6.2 postcss-loader: ^7.0.2 postcss-pxtorem: ^6.0.0 pug-loader: ^2.4.0 + querystring: ^0.2.1 react-refresh: 0.14.0 react-relay: ^14.1.0 sass: ^1.56.2 @@ -1019,7 +1021,9 @@ importers: compare-versions: 6.0.0-rc.1 enhanced-resolve: 5.12.0 graceful-fs: 4.2.10 + json-parse-even-better-errors: 3.0.0 neo-async: 2.6.2 + querystring: 0.2.1 react-refresh: 0.14.0 schema-utils: 4.0.0 tapable: 2.2.1 @@ -13512,7 +13516,6 @@ packages: dependencies: webpack: 5.76.0_webpack-cli@4.10.0 webpack-cli: 4.10.0_webpack@5.76.0 - dev: true /@webpack-cli/info/1.5.0_webpack-cli@4.10.0: resolution: {integrity: sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==} @@ -13521,7 +13524,6 @@ packages: dependencies: envinfo: 7.8.1 webpack-cli: 4.10.0_webpack@5.76.0 - dev: true /@webpack-cli/serve/1.7.0_webpack-cli@4.10.0: resolution: {integrity: sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==} @@ -13533,7 +13535,6 @@ packages: optional: true dependencies: webpack-cli: 4.10.0_webpack@5.76.0 - dev: true /@xtuc/ieee754/1.2.0: resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} @@ -15490,7 +15491,6 @@ packages: is-plain-object: 2.0.4 kind-of: 6.0.3 shallow-clone: 3.0.1 - dev: true /clone-response/1.0.2: resolution: {integrity: sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==} @@ -17280,7 +17280,6 @@ packages: resolution: {integrity: sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==} engines: {node: '>=4'} hasBin: true - dev: true /err-code/2.0.3: resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} @@ -18016,7 +18015,6 @@ packages: /fastest-levenshtein/1.0.16: resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} engines: {node: '>= 4.9.1'} - dev: true /fastq/1.13.0: resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} @@ -19662,7 +19660,6 @@ packages: dependencies: pkg-dir: 4.2.0 resolve-cwd: 3.0.0 - dev: true /imurmurhash/0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} @@ -19800,7 +19797,6 @@ packages: /interpret/2.2.0: resolution: {integrity: sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==} engines: {node: '>= 0.10'} - dev: true /interpret/3.1.1: resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} @@ -20162,7 +20158,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: isobject: 3.0.1 - dev: true /is-plain-object/5.0.0: resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} @@ -20353,7 +20348,6 @@ packages: /isobject/3.0.1: resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} engines: {node: '>=0.10.0'} - dev: true /isomorphic-fetch/2.2.1: resolution: {integrity: sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA==} @@ -21080,7 +21074,6 @@ packages: /json-parse-even-better-errors/3.0.0: resolution: {integrity: sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true /json-schema-traverse/0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} @@ -21264,7 +21257,6 @@ packages: /kind-of/6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} - dev: true /kleur/3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} @@ -24698,6 +24690,12 @@ packages: deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. dev: false + /querystring/0.2.1: + resolution: {integrity: sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==} + engines: {node: '>=0.4.x'} + deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. + dev: false + /queue-microtask/1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -25310,7 +25308,6 @@ packages: engines: {node: '>= 0.10'} dependencies: resolve: 1.22.2 - dev: true /rechoir/0.8.0: resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} @@ -25597,7 +25594,6 @@ packages: engines: {node: '>=8'} dependencies: resolve-from: 5.0.0 - dev: true /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} @@ -25606,7 +25602,6 @@ packages: /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - dev: true /resolve-pathname/3.0.0: resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} @@ -26310,7 +26305,6 @@ packages: engines: {node: '>=8'} dependencies: kind-of: 6.0.3 - dev: true /shallowequal/1.1.0: resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==} @@ -27851,7 +27845,7 @@ packages: schema-utils: 3.1.2 serialize-javascript: 6.0.1 terser: 5.17.1 - webpack: 5.76.0 + webpack: 5.76.0_webpack-cli@4.10.0 /terser/5.16.1: resolution: {integrity: sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==} @@ -29307,7 +29301,6 @@ packages: rechoir: 0.7.1 webpack: 5.76.0_webpack-cli@4.10.0 webpack-merge: 5.9.0 - dev: true /webpack-dev-middleware/5.3.3: resolution: {integrity: sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==} @@ -29582,7 +29575,6 @@ packages: dependencies: clone-deep: 4.0.1 wildcard: 2.0.0 - dev: true /webpack-sources/2.3.1: resolution: {integrity: sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==} @@ -29697,7 +29689,6 @@ packages: - '@swc/core' - esbuild - uglify-js - dev: true /webpack/5.80.0_esbuild@0.17.18: resolution: {integrity: sha512-OIMiq37XK1rWO8mH9ssfFKZsXg4n6klTEDL7S8/HqbAOBBaiy8ABvXvz0dDCXeEF9gqwxSvVk611zFPjS8hJxA==} @@ -29865,7 +29856,6 @@ packages: /wildcard/2.0.0: resolution: {integrity: sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==} - dev: true /window-size/0.1.0: resolution: {integrity: sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==} diff --git a/webpack-test/cases/loaders/coffee-loader/test.filter.js b/webpack-test/cases/loaders/coffee-loader/test.filter.js index 801a0693f49..8b5c6c57288 100644 --- a/webpack-test/cases/loaders/coffee-loader/test.filter.js +++ b/webpack-test/cases/loaders/coffee-loader/test.filter.js @@ -1,4 +1,3 @@ module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4396"} - \ No newline at end of file diff --git a/webpack-test/configCases/loaders/options/deprecations.js b/webpack-test/configCases/loaders/options/deprecations.js index 6c3c0c2f1b2..8a666cac60f 100644 --- a/webpack-test/configCases/loaders/options/deprecations.js +++ b/webpack-test/configCases/loaders/options/deprecations.js @@ -1,9 +1,9 @@ module.exports = [ - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ } + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ } ]; diff --git a/webpack-test/configCases/loaders/options/errors.js b/webpack-test/configCases/loaders/options/errors.js index 3ea73741041..e6af6e70b2f 100644 --- a/webpack-test/configCases/loaders/options/errors.js +++ b/webpack-test/configCases/loaders/options/errors.js @@ -1,12 +1,12 @@ module.exports = [ - [ - /\.\/loader-1\.js/, - /Loader has been/, - /options\.arg6\.bar\.baz should be a string/ - ], - [ - /\.\/loader-2\.js/, - /Custom Loader Name has been/, - /configuration\.arg should be true/ - ] + // [ + // /\.\/loader-1\.js/, + // /Loader has been/, + // /options\.arg6\.bar\.baz should be a string/ + // ], + // [ + // /\.\/loader-2\.js/, + // /Custom Loader Name has been/, + // /configuration\.arg should be true/ + // ] ]; diff --git a/webpack-test/configCases/loaders/options/index.js b/webpack-test/configCases/loaders/options/index.js index 56896b7c2ef..33cc2cdea1e 100644 --- a/webpack-test/configCases/loaders/options/index.js +++ b/webpack-test/configCases/loaders/options/index.js @@ -44,8 +44,8 @@ it("should get options", function() { }); }); -const never = false; -if (never) { - require("./error1"); - require("./error2"); -} +// const never = false; +// if (never) { +// require("./error1"); +// require("./error2"); +// } diff --git a/webpack-test/configCases/loaders/options/test.filter.js b/webpack-test/configCases/loaders/options/test.filter.js deleted file mode 100644 index 3be456dcd23..00000000000 --- a/webpack-test/configCases/loaders/options/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file From 472ee73faab8ffb8bf26993ea0adc55f97b4fe00 Mon Sep 17 00:00:00 2001 From: Hana Date: Wed, 25 Oct 2023 12:25:17 +0800 Subject: [PATCH 2/5] test: more test cases --- .../builtin-swc-loader/source-map/a.ts | 4 ++ .../builtin-swc-loader/source-map/index.js | 51 +++++++++++++++++++ .../source-map/webpack.config.js | 30 +++++++++++ .../source-map/source-map/index.js | 3 +- 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 packages/rspack/tests/configCases/builtin-swc-loader/source-map/a.ts create mode 100644 packages/rspack/tests/configCases/builtin-swc-loader/source-map/index.js create mode 100644 packages/rspack/tests/configCases/builtin-swc-loader/source-map/webpack.config.js diff --git a/packages/rspack/tests/configCases/builtin-swc-loader/source-map/a.ts b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/a.ts new file mode 100644 index 00000000000..ec127c18f7a --- /dev/null +++ b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/a.ts @@ -0,0 +1,4 @@ +let foo: string = "f1"; +let bar: string = "b1"; +let baz: string = "b2"; +const boo = "abc"; diff --git a/packages/rspack/tests/configCases/builtin-swc-loader/source-map/index.js b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/index.js new file mode 100644 index 00000000000..4c158ae172d --- /dev/null +++ b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/index.js @@ -0,0 +1,51 @@ +require("./a"); + +it("should generate correct sourceMap", async () => { + const path = require("path"); + const fs = require("fs"); + const source = fs.readFileSync(__filename + ".map", "utf-8"); + const map = JSON.parse(source); + const sourceContent = fs.readFileSync( + path.resolve(__dirname, "../a.ts"), + "utf-8" + ); + expect(map.sources).toContain("./a.ts"); + expect(map.sourcesContent[1]).toEqual(sourceContent); + + checkStub("fo" + "o", sourceContent); + checkStub("ba" + "r", sourceContent); + checkStub("ba" + "z", sourceContent); + checkStub(wrap("f" + 1), sourceContent); + checkStub(wrap("b" + 1), sourceContent); + checkStub(wrap("b" + 2), sourceContent); + checkStub(wrap("ab" + "c"), sourceContent); +}); + +const wrap = v => `"${v}"`; +const checkStub = async (stub, sourceContent) => { + const fs = require("fs"); + const { SourceMapConsumer } = require("source-map"); + + const source = fs.readFileSync(__filename + ".map", "utf-8"); + const map = JSON.parse(source); + const consumer = await new SourceMapConsumer(map); + const generated = fs.readFileSync(__filename, "utf-8"); + const { line, column } = consumer.originalPositionFor( + positionFor(generated, stub) + ); + const { line: originalLine, column: originalColumn } = positionFor( + sourceContent, + stub + ); + expect(line).toBe(originalLine); + expect(column).toBe(originalColumn); +}; + +const positionFor = (content, text) => { + let lines = content.split(/\r?\n/); + for (let i = 0; i < lines.length; i++) { + const column = lines[i].indexOf(text); + if (column >= 0) return { line: i + 1, column }; + } + return null; +}; diff --git a/packages/rspack/tests/configCases/builtin-swc-loader/source-map/webpack.config.js b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/webpack.config.js new file mode 100644 index 00000000000..9a885b0413b --- /dev/null +++ b/packages/rspack/tests/configCases/builtin-swc-loader/source-map/webpack.config.js @@ -0,0 +1,30 @@ +module.exports = { + devtool: "source-map", + externals: ["source-map"], + externalsType: "commonjs", + module: { + rules: [ + { + test: /\.ts$/, + use: [ + { + loader: "builtin:swc-loader", + options: { + jsc: { + parser: { + syntax: "typescript" + } + } + } + } + ], + type: "javascript/auto" + } + ] + }, + experiments: { + rspackFuture: { + disableTransformByDefault: true + } + } +}; diff --git a/packages/rspack/tests/configCases/source-map/source-map/index.js b/packages/rspack/tests/configCases/source-map/source-map/index.js index f18605afdac..3e95531b819 100644 --- a/packages/rspack/tests/configCases/source-map/source-map/index.js +++ b/packages/rspack/tests/configCases/source-map/source-map/index.js @@ -12,8 +12,7 @@ it("should map to the original content if `module` enabled", async () => { const consumer = await new sourceMap.SourceMapConsumer(map); expect(map.sources).toContain("./App.jsx"); expect(map.sourcesContent[1]).toEqual(app); - const STUB = - "\u0048\u0065\u006c\u006c\u006f\u0020\u0052\u0073\u0070\u0061\u0063\u006b\u0021"; + const STUB = "Hello" + " " + "Rspack!"; const { line, column } = consumer.originalPositionFor( positionFor(generated, STUB) ); From 4d81bdf1c6fe1c3607943619fe8e2d50278b9c11 Mon Sep 17 00:00:00 2001 From: Hana Date: Wed, 25 Oct 2023 12:30:55 +0800 Subject: [PATCH 3/5] chore: cleanup --- packages/rspack/src/loader-runner/index.ts | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/rspack/src/loader-runner/index.ts b/packages/rspack/src/loader-runner/index.ts index 2ec6ec2df5e..deb1b2575bd 100644 --- a/packages/rspack/src/loader-runner/index.ts +++ b/packages/rspack/src/loader-runner/index.ts @@ -96,25 +96,8 @@ function createLoaderObject(loader: any, compiler: Compiler): LoaderObject { obj.path = splittedRequest.path; obj.query = splittedRequest.query; obj.fragment = splittedRequest.fragment; - - if (obj.query.startsWith("??")) { - const ident = obj.query.slice(2); - if (ident === "[[missing ident]]") { - throw new Error( - "No ident is provided by referenced loader. " + - "When using a function for Rule.use in config you need to " + - "provide an 'ident' property for referenced loader options." - ); - } - obj.options = compiler.ruleSet.references.get(ident); - if (obj.options === undefined) { - throw new Error("Invalid ident is provided by referenced loader"); - } - obj.ident = ident; - } else { - obj.options = undefined; - obj.ident = undefined; - } + obj.options = undefined; + obj.ident = undefined; } else { if (!value.loader) throw new Error( From d8018df54b576e106a948046e2c51a378ccdf06f Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Wed, 25 Oct 2023 17:22:43 +0800 Subject: [PATCH 4/5] test --- .../tests/configCases/loader/options/a.js | 0 .../tests/configCases/loader/options/b.js | 0 .../tests/configCases/loader/options/c.js | 0 .../tests/configCases/loader/options/d.js | 0 .../tests/configCases/loader/options/e.js | 0 .../configCases/loader/options/error1.js | 0 .../configCases/loader/options/error2.js | 0 .../tests/configCases/loader/options/f.js | 0 .../tests/configCases/loader/options/g.js | 0 .../tests/configCases/loader/options/h.js | 0 .../tests/configCases/loader/options/i.js | 0 .../tests/configCases/loader/options/index.js | 45 ++++++ .../loader/options/infrastructure-log.js | 3 + .../configCases/loader/options/loader-1.js | 12 ++ .../loader/options/loader-1.options.json | 43 ++++++ .../configCases/loader/options/loader-2.js | 12 ++ .../loader/options/loader-2.options.json | 10 ++ .../configCases/loader/options/loader.js | 10 ++ .../loader/options/webpack.config.js | 93 ++++++++++++ pnpm-lock.yaml | 37 ++++- .../large/many-replacements/test.filter.js | 7 - .../loaders/coffee-loader/test.filter.js | 3 - .../loaders/options/deprecations.js | 14 +- .../configCases/loaders/options/errors.js | 20 +-- .../configCases/loaders/options/index.js | 10 +- .../loaders/options/test.filter.js | 1 + webpack-test/package.json | 4 +- .../rspack/node_modules/make-dir/index.d.ts | 39 +++++ .../rspack/node_modules/make-dir/index.js | 139 ++++++++++++++++++ .../rspack/node_modules/make-dir/license | 9 ++ .../rspack/node_modules/make-dir/package.json | 59 ++++++++ .../rspack/node_modules/make-dir/readme.md | 123 ++++++++++++++++ webpack-test/scripts/test-metric-util.js | 4 +- 33 files changed, 653 insertions(+), 44 deletions(-) create mode 100644 packages/rspack/tests/configCases/loader/options/a.js create mode 100644 packages/rspack/tests/configCases/loader/options/b.js create mode 100644 packages/rspack/tests/configCases/loader/options/c.js create mode 100644 packages/rspack/tests/configCases/loader/options/d.js create mode 100644 packages/rspack/tests/configCases/loader/options/e.js create mode 100644 packages/rspack/tests/configCases/loader/options/error1.js create mode 100644 packages/rspack/tests/configCases/loader/options/error2.js create mode 100644 packages/rspack/tests/configCases/loader/options/f.js create mode 100644 packages/rspack/tests/configCases/loader/options/g.js create mode 100644 packages/rspack/tests/configCases/loader/options/h.js create mode 100644 packages/rspack/tests/configCases/loader/options/i.js create mode 100644 packages/rspack/tests/configCases/loader/options/index.js create mode 100644 packages/rspack/tests/configCases/loader/options/infrastructure-log.js create mode 100644 packages/rspack/tests/configCases/loader/options/loader-1.js create mode 100644 packages/rspack/tests/configCases/loader/options/loader-1.options.json create mode 100644 packages/rspack/tests/configCases/loader/options/loader-2.js create mode 100644 packages/rspack/tests/configCases/loader/options/loader-2.options.json create mode 100644 packages/rspack/tests/configCases/loader/options/loader.js create mode 100644 packages/rspack/tests/configCases/loader/options/webpack.config.js delete mode 100644 webpack-test/cases/loaders/coffee-loader/test.filter.js create mode 100644 webpack-test/configCases/loaders/options/test.filter.js create mode 100644 webpack-test/packages/rspack/node_modules/make-dir/index.d.ts create mode 100644 webpack-test/packages/rspack/node_modules/make-dir/index.js create mode 100644 webpack-test/packages/rspack/node_modules/make-dir/license create mode 100644 webpack-test/packages/rspack/node_modules/make-dir/package.json create mode 100644 webpack-test/packages/rspack/node_modules/make-dir/readme.md diff --git a/packages/rspack/tests/configCases/loader/options/a.js b/packages/rspack/tests/configCases/loader/options/a.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/b.js b/packages/rspack/tests/configCases/loader/options/b.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/c.js b/packages/rspack/tests/configCases/loader/options/c.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/d.js b/packages/rspack/tests/configCases/loader/options/d.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/e.js b/packages/rspack/tests/configCases/loader/options/e.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/error1.js b/packages/rspack/tests/configCases/loader/options/error1.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/error2.js b/packages/rspack/tests/configCases/loader/options/error2.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/f.js b/packages/rspack/tests/configCases/loader/options/f.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/g.js b/packages/rspack/tests/configCases/loader/options/g.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/h.js b/packages/rspack/tests/configCases/loader/options/h.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/i.js b/packages/rspack/tests/configCases/loader/options/i.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/rspack/tests/configCases/loader/options/index.js b/packages/rspack/tests/configCases/loader/options/index.js new file mode 100644 index 00000000000..66eca065d4e --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/index.js @@ -0,0 +1,45 @@ +it("should get options", function () { + expect(require("./a")).toStrictEqual({ + arg: true, + arg1: null, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + }); + expect(require("./b")).toStrictEqual({ + arg: true, + arg1: null, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + }); + expect(require("./c")).toStrictEqual({ + arg: true, + arg1: null, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + }); + expect(require("./d")).toStrictEqual({ + arg4: "text" + }); + expect(require("./e")).toStrictEqual({}); + expect(require("./f")).toStrictEqual({ + delicious: "", + name: "cheesecake", + slices: "8", + warm: "false" + }); + expect(require("./g")).toStrictEqual({ + "=": "=" + }); + expect(require("./h")).toStrictEqual({ + foo: "bar" + }); + expect(require("./i")).toStrictEqual({ + foo: "bar" + }); +}); diff --git a/packages/rspack/tests/configCases/loader/options/infrastructure-log.js b/packages/rspack/tests/configCases/loader/options/infrastructure-log.js new file mode 100644 index 00000000000..47af2b051a6 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/infrastructure-log.js @@ -0,0 +1,3 @@ +module.exports = [ + /^Pack got invalid because of write to: Compilation\/modules.+loaders[/\\]options[/\\]error1\.js$/ +]; diff --git a/packages/rspack/tests/configCases/loader/options/loader-1.js b/packages/rspack/tests/configCases/loader/options/loader-1.js new file mode 100644 index 00000000000..4614a709d80 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/loader-1.js @@ -0,0 +1,12 @@ +const schema = require("./loader-1.options.json"); + +/** @type {import("@rspack/core").LoaderDefinition} */ +module.exports = function () { + const options = this.getOptions(schema); + + const json = JSON.stringify(options) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); + + return `module.exports = ${json}`; +}; diff --git a/packages/rspack/tests/configCases/loader/options/loader-1.options.json b/packages/rspack/tests/configCases/loader/options/loader-1.options.json new file mode 100644 index 00000000000..3c86ba01025 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/loader-1.options.json @@ -0,0 +1,43 @@ +{ + "additionalProperties": false, + "properties": { + "arg": { + "type": "boolean" + }, + "arg1": { + "type": "null" + }, + "arg2": {}, + "arg3": { + "type": "number" + }, + "arg4": { + "type": "string" + }, + "arg5": { + "type": "array", + "items": { + "type": "number" + } + }, + "arg6": { + "type": "object", + "properties": { + "foo": { + "type": "string" + }, + "bar": { + "type": "object", + "properties": { + "baz": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "type": "object" +} diff --git a/packages/rspack/tests/configCases/loader/options/loader-2.js b/packages/rspack/tests/configCases/loader/options/loader-2.js new file mode 100644 index 00000000000..c645b12a668 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/loader-2.js @@ -0,0 +1,12 @@ +const schema = require("./loader-2.options.json"); + +/** @type {import("@rspack/core").LoaderDefinition} */ +module.exports = function () { + const options = this.getOptions(schema); + + const json = JSON.stringify(options) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); + + return `module.exports = ${json}`; +}; diff --git a/packages/rspack/tests/configCases/loader/options/loader-2.options.json b/packages/rspack/tests/configCases/loader/options/loader-2.options.json new file mode 100644 index 00000000000..d17814f5fcf --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/loader-2.options.json @@ -0,0 +1,10 @@ +{ + "title": "Custom Loader Name configuration", + "additionalProperties": false, + "properties": { + "arg": { + "enum": [true] + } + }, + "type": "object" +} diff --git a/packages/rspack/tests/configCases/loader/options/loader.js b/packages/rspack/tests/configCases/loader/options/loader.js new file mode 100644 index 00000000000..95ce29ab040 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/loader.js @@ -0,0 +1,10 @@ +/** @type {import("@rspack/core").LoaderDefinition} */ +module.exports = function () { + const options = this.getOptions(); + + const json = JSON.stringify(options) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); + + return `module.exports = ${json}`; +}; diff --git a/packages/rspack/tests/configCases/loader/options/webpack.config.js b/packages/rspack/tests/configCases/loader/options/webpack.config.js new file mode 100644 index 00000000000..56d11578126 --- /dev/null +++ b/packages/rspack/tests/configCases/loader/options/webpack.config.js @@ -0,0 +1,93 @@ +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + mode: "none", + module: { + rules: [ + { + test: /a\.js$/, + loader: "./loader", + options: { + arg: true, + arg1: null, + arg2: undefined, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + } + }, + { + test: /b\.js$/, + loader: "./loader-1", + options: { + arg: true, + arg1: null, + arg2: undefined, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + } + }, + { + test: /c\.js$/, + loader: "./loader-1", + options: JSON.stringify({ + arg: true, + arg1: null, + arg2: undefined, + arg3: 1234567890, + arg4: "string", + arg5: [1, 2, 3], + arg6: { foo: "value", bar: { baz: "other-value" } } + }) + }, + { + test: /d\.js$/, + loader: "./loader-1", + options: "arg4=text" + }, + { + test: /d\.js$/, + loader: "./loader", + options: "" + }, + { + test: /f\.js$/, + loader: "./loader", + options: "name=cheesecake&slices=8&delicious&warm=false" + }, + { + test: /g\.js$/, + loader: "./loader", + options: "%3d=%3D" + }, + { + test: /h\.js$/, + loader: "./loader", + options: "foo=bar" + }, + { + test: /i\.js$/, + loader: "./loader", + options: `${JSON.stringify({ + foo: "bar" + })}` + }, + { + test: /error1\.js$/, + loader: "./loader-1", + options: { + arg6: { foo: "value", bar: { baz: 42 } } + } + }, + { + test: /error2\.js$/, + loader: "./loader-2", + options: { + arg: false + } + } + ] + } +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fa247e4e401..20fa90df9f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1293,8 +1293,8 @@ importers: babel-plugin-import: ^1.13.5 browserslist: ^4.21.3 chokidar: 3.5.3 - coffee-loader: ^4.0.0 - coffeescript: ^2.7.0 + coffee-loader: ^1.0.0 + coffeescript: ^2.5.1 copy-webpack-plugin: '5' csv-to-markdown-table: ^1.3.0 enhanced-resolve: 5.12.0 @@ -1352,7 +1352,7 @@ importers: babel-loader: 9.1.2 babel-plugin-import: 1.13.5 chokidar: 3.5.3 - coffee-loader: 4.0.0_coffeescript@2.7.0 + coffee-loader: 1.0.1_coffeescript@2.7.0 coffeescript: 2.7.0 copy-webpack-plugin: 5.1.2 csv-to-markdown-table: 1.3.0 @@ -13516,6 +13516,7 @@ packages: dependencies: webpack: 5.76.0_webpack-cli@4.10.0 webpack-cli: 4.10.0_webpack@5.76.0 + dev: true /@webpack-cli/info/1.5.0_webpack-cli@4.10.0: resolution: {integrity: sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==} @@ -13524,6 +13525,7 @@ packages: dependencies: envinfo: 7.8.1 webpack-cli: 4.10.0_webpack@5.76.0 + dev: true /@webpack-cli/serve/1.7.0_webpack-cli@4.10.0: resolution: {integrity: sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==} @@ -13535,6 +13537,7 @@ packages: optional: true dependencies: webpack-cli: 4.10.0_webpack@5.76.0 + dev: true /@xtuc/ieee754/1.2.0: resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} @@ -15491,6 +15494,7 @@ packages: is-plain-object: 2.0.4 kind-of: 6.0.3 shallow-clone: 3.0.1 + dev: true /clone-response/1.0.2: resolution: {integrity: sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==} @@ -15519,14 +15523,16 @@ packages: engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} dev: true - /coffee-loader/4.0.0_coffeescript@2.7.0: - resolution: {integrity: sha512-RvgC8c0JwRew5lq3x2J+P4z9Cvan/v91muEvV90VJXcTuJbJQN20taZxfj6/XC4yysA8PInPGpxdB1J9LphLuQ==} - engines: {node: '>= 14.15.0'} + /coffee-loader/1.0.1_coffeescript@2.7.0: + resolution: {integrity: sha512-l3lcWeyNE11ZXNYEpkIkerrvBdSpT06/kcR7MyY+0ys38MOuqzhr+s+s7Tsvv2QH1+qEmhvG8mGuUWIO2zH7Bg==} + engines: {node: '>= 10.13.0'} peerDependencies: coffeescript: '>= 2.0.0' - webpack: ^5.0.0 + webpack: ^4.0.0 || ^5.0.0 dependencies: coffeescript: 2.7.0 + loader-utils: 2.0.4 + schema-utils: 3.1.2 dev: true /coffeescript/2.7.0: @@ -17280,6 +17286,7 @@ packages: resolution: {integrity: sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==} engines: {node: '>=4'} hasBin: true + dev: true /err-code/2.0.3: resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} @@ -18015,6 +18022,7 @@ packages: /fastest-levenshtein/1.0.16: resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} engines: {node: '>= 4.9.1'} + dev: true /fastq/1.13.0: resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} @@ -19660,6 +19668,7 @@ packages: dependencies: pkg-dir: 4.2.0 resolve-cwd: 3.0.0 + dev: true /imurmurhash/0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} @@ -19797,6 +19806,7 @@ packages: /interpret/2.2.0: resolution: {integrity: sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==} engines: {node: '>= 0.10'} + dev: true /interpret/3.1.1: resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} @@ -20158,6 +20168,7 @@ packages: engines: {node: '>=0.10.0'} dependencies: isobject: 3.0.1 + dev: true /is-plain-object/5.0.0: resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} @@ -20348,6 +20359,7 @@ packages: /isobject/3.0.1: resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} engines: {node: '>=0.10.0'} + dev: true /isomorphic-fetch/2.2.1: resolution: {integrity: sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA==} @@ -21257,6 +21269,7 @@ packages: /kind-of/6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} + dev: true /kleur/3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} @@ -25308,6 +25321,7 @@ packages: engines: {node: '>= 0.10'} dependencies: resolve: 1.22.2 + dev: true /rechoir/0.8.0: resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} @@ -25594,6 +25608,7 @@ packages: engines: {node: '>=8'} dependencies: resolve-from: 5.0.0 + dev: true /resolve-from/4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} @@ -25602,6 +25617,7 @@ packages: /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + dev: true /resolve-pathname/3.0.0: resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} @@ -26305,6 +26321,7 @@ packages: engines: {node: '>=8'} dependencies: kind-of: 6.0.3 + dev: true /shallowequal/1.1.0: resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==} @@ -27845,7 +27862,7 @@ packages: schema-utils: 3.1.2 serialize-javascript: 6.0.1 terser: 5.17.1 - webpack: 5.76.0_webpack-cli@4.10.0 + webpack: 5.76.0 /terser/5.16.1: resolution: {integrity: sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==} @@ -29301,6 +29318,7 @@ packages: rechoir: 0.7.1 webpack: 5.76.0_webpack-cli@4.10.0 webpack-merge: 5.9.0 + dev: true /webpack-dev-middleware/5.3.3: resolution: {integrity: sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==} @@ -29575,6 +29593,7 @@ packages: dependencies: clone-deep: 4.0.1 wildcard: 2.0.0 + dev: true /webpack-sources/2.3.1: resolution: {integrity: sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==} @@ -29689,6 +29708,7 @@ packages: - '@swc/core' - esbuild - uglify-js + dev: true /webpack/5.80.0_esbuild@0.17.18: resolution: {integrity: sha512-OIMiq37XK1rWO8mH9ssfFKZsXg4n6klTEDL7S8/HqbAOBBaiy8ABvXvz0dDCXeEF9gqwxSvVk611zFPjS8hJxA==} @@ -29856,6 +29876,7 @@ packages: /wildcard/2.0.0: resolution: {integrity: sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==} + dev: true /window-size/0.1.0: resolution: {integrity: sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==} diff --git a/webpack-test/cases/large/many-replacements/test.filter.js b/webpack-test/cases/large/many-replacements/test.filter.js index 1ae95bcd901..71a71e594ff 100644 --- a/webpack-test/cases/large/many-replacements/test.filter.js +++ b/webpack-test/cases/large/many-replacements/test.filter.js @@ -1,10 +1,3 @@ - -/* module.exports = function (config) { return !process.env.CI; }; - -*/ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4396"} - - \ No newline at end of file diff --git a/webpack-test/cases/loaders/coffee-loader/test.filter.js b/webpack-test/cases/loaders/coffee-loader/test.filter.js deleted file mode 100644 index 8b5c6c57288..00000000000 --- a/webpack-test/cases/loaders/coffee-loader/test.filter.js +++ /dev/null @@ -1,3 +0,0 @@ - -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4396"} - diff --git a/webpack-test/configCases/loaders/options/deprecations.js b/webpack-test/configCases/loaders/options/deprecations.js index 8a666cac60f..6c3c0c2f1b2 100644 --- a/webpack-test/configCases/loaders/options/deprecations.js +++ b/webpack-test/configCases/loaders/options/deprecations.js @@ -1,9 +1,9 @@ module.exports = [ - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, - // { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ } + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ }, + { code: /DEP_WEBPACK_RULE_LOADER_OPTIONS_STRING/ } ]; diff --git a/webpack-test/configCases/loaders/options/errors.js b/webpack-test/configCases/loaders/options/errors.js index e6af6e70b2f..3ea73741041 100644 --- a/webpack-test/configCases/loaders/options/errors.js +++ b/webpack-test/configCases/loaders/options/errors.js @@ -1,12 +1,12 @@ module.exports = [ - // [ - // /\.\/loader-1\.js/, - // /Loader has been/, - // /options\.arg6\.bar\.baz should be a string/ - // ], - // [ - // /\.\/loader-2\.js/, - // /Custom Loader Name has been/, - // /configuration\.arg should be true/ - // ] + [ + /\.\/loader-1\.js/, + /Loader has been/, + /options\.arg6\.bar\.baz should be a string/ + ], + [ + /\.\/loader-2\.js/, + /Custom Loader Name has been/, + /configuration\.arg should be true/ + ] ]; diff --git a/webpack-test/configCases/loaders/options/index.js b/webpack-test/configCases/loaders/options/index.js index 33cc2cdea1e..56896b7c2ef 100644 --- a/webpack-test/configCases/loaders/options/index.js +++ b/webpack-test/configCases/loaders/options/index.js @@ -44,8 +44,8 @@ it("should get options", function() { }); }); -// const never = false; -// if (never) { -// require("./error1"); -// require("./error2"); -// } +const never = false; +if (never) { + require("./error1"); + require("./error2"); +} diff --git a/webpack-test/configCases/loaders/options/test.filter.js b/webpack-test/configCases/loaders/options/test.filter.js new file mode 100644 index 00000000000..98e4afe7608 --- /dev/null +++ b/webpack-test/configCases/loaders/options/test.filter.js @@ -0,0 +1 @@ +module.exports = () => {return false} diff --git a/webpack-test/package.json b/webpack-test/package.json index 38c2c6d0a58..ba8e551fa72 100644 --- a/webpack-test/package.json +++ b/webpack-test/package.json @@ -27,8 +27,8 @@ "babel-loader": "^9.1.0", "babel-plugin-import": "^1.13.5", "chokidar": "3.5.3", - "coffee-loader": "^4.0.0", - "coffeescript": "^2.7.0", + "coffee-loader": "^1.0.0", + "coffeescript": "^2.5.1", "copy-webpack-plugin": "5", "csv-to-markdown-table": "^1.3.0", "file-loader": "^6.2.0", diff --git a/webpack-test/packages/rspack/node_modules/make-dir/index.d.ts b/webpack-test/packages/rspack/node_modules/make-dir/index.d.ts new file mode 100644 index 00000000000..3e1529c6210 --- /dev/null +++ b/webpack-test/packages/rspack/node_modules/make-dir/index.d.ts @@ -0,0 +1,39 @@ +/// +import * as fs from 'fs'; + +export interface Options { + /** + * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + * + * @default 0o777 & (~process.umask()) + */ + readonly mode?: number; + + /** + * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + * + * Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + * + * @default require('fs') + */ + readonly fs?: typeof fs; +} + +/** + * Make a directory and its parents if needed - Think `mkdir -p`. + * + * @param path - Directory to create. + * @returns A `Promise` for the path to the created directory. + */ +export default function makeDir( + path: string, + options?: Options +): Promise; + +/** + * Synchronously make a directory and its parents if needed - Think `mkdir -p`. + * + * @param path - Directory to create. + * @returns The path to the created directory. + */ +export function sync(path: string, options?: Options): string; diff --git a/webpack-test/packages/rspack/node_modules/make-dir/index.js b/webpack-test/packages/rspack/node_modules/make-dir/index.js new file mode 100644 index 00000000000..4d95c916405 --- /dev/null +++ b/webpack-test/packages/rspack/node_modules/make-dir/index.js @@ -0,0 +1,139 @@ +'use strict'; +const fs = require('fs'); +const path = require('path'); +const pify = require('pify'); +const semver = require('semver'); + +const defaults = { + mode: 0o777 & (~process.umask()), + fs +}; + +const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +const checkPath = pth => { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); + + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`); + error.code = 'EINVAL'; + throw error; + } + } +}; + +const permissionError = pth => { + // This replicates the exception of `fs.mkdir` with native the + // `recusive` option when run on an invalid drive under Windows. + const error = new Error(`operation not permitted, mkdir '${pth}'`); + error.code = 'EPERM'; + error.errno = -4048; + error.path = pth; + error.syscall = 'mkdir'; + return error; +}; + +const makeDir = (input, options) => Promise.resolve().then(() => { + checkPath(input); + options = Object.assign({}, defaults, options); + + // TODO: Use util.promisify when targeting Node.js 8 + const mkdir = pify(options.fs.mkdir); + const stat = pify(options.fs.stat); + + if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { + const pth = path.resolve(input); + + return mkdir(pth, { + mode: options.mode, + recursive: true + }).then(() => pth); + } + + const make = pth => { + return mkdir(pth, options.mode) + .then(() => pth) + .catch(error => { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; + } + + return make(path.dirname(pth)).then(() => make(pth)); + } + + return stat(pth) + .then(stats => stats.isDirectory() ? pth : Promise.reject()) + .catch(() => { + throw error; + }); + }); + }; + + return make(path.resolve(input)); +}); + +module.exports = makeDir; +module.exports.default = makeDir; + +module.exports.sync = (input, options) => { + checkPath(input); + options = Object.assign({}, defaults, options); + + if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { + const pth = path.resolve(input); + + fs.mkdirSync(pth, { + mode: options.mode, + recursive: true + }); + + return pth; + } + + const make = pth => { + try { + options.fs.mkdirSync(pth, options.mode); + } catch (error) { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; + } + + make(path.dirname(pth)); + return make(pth); + } + + try { + if (!options.fs.statSync(pth).isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { + throw error; + } + } + + return pth; + }; + + return make(path.resolve(input)); +}; diff --git a/webpack-test/packages/rspack/node_modules/make-dir/license b/webpack-test/packages/rspack/node_modules/make-dir/license new file mode 100644 index 00000000000..e7af2f77107 --- /dev/null +++ b/webpack-test/packages/rspack/node_modules/make-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/webpack-test/packages/rspack/node_modules/make-dir/package.json b/webpack-test/packages/rspack/node_modules/make-dir/package.json new file mode 100644 index 00000000000..1b51bf70f72 --- /dev/null +++ b/webpack-test/packages/rspack/node_modules/make-dir/package.json @@ -0,0 +1,59 @@ +{ + "name": "make-dir", + "version": "2.1.0", + "description": "Make a directory and its parents if needed - Think `mkdir -p`", + "license": "MIT", + "repository": "sindresorhus/make-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && nyc ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "mkdir", + "mkdirp", + "make", + "directories", + "dir", + "dirs", + "folders", + "directory", + "folder", + "path", + "parent", + "parents", + "intermediate", + "recursively", + "recursive", + "create", + "fs", + "filesystem", + "file-system" + ], + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "devDependencies": { + "@types/graceful-fs": "^4.1.3", + "@types/node": "^11.10.4", + "ava": "^1.2.0", + "codecov": "^3.0.0", + "graceful-fs": "^4.1.11", + "nyc": "^13.1.0", + "path-type": "^3.0.0", + "tempy": "^0.2.1", + "tsd-check": "^0.3.0", + "xo": "^0.24.0" + } +} diff --git a/webpack-test/packages/rspack/node_modules/make-dir/readme.md b/webpack-test/packages/rspack/node_modules/make-dir/readme.md new file mode 100644 index 00000000000..8c225c1f6a7 --- /dev/null +++ b/webpack-test/packages/rspack/node_modules/make-dir/readme.md @@ -0,0 +1,123 @@ +# make-dir [![Build Status](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir) + +> Make a directory and its parents if needed - Think `mkdir -p` + + +## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp) + +- Promise API *(Async/await ready!)* +- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66) +- 100% test coverage +- CI-tested on macOS, Linux, and Windows +- Actively maintained +- Doesn't bundle a CLI +- Uses native the `fs.mkdir/mkdirSync` [`recursive` option](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_mkdir_path_options_callback) in Node.js >=10.12.0 unless [overridden](#fs) + + +## Install + +``` +$ npm install make-dir +``` + + +## Usage + +``` +$ pwd +/Users/sindresorhus/fun +$ tree +. +``` + +```js +const makeDir = require('make-dir'); + +(async () => { + const path = await makeDir('unicorn/rainbow/cake'); + + console.log(path); + //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake' +})(); +``` + +``` +$ tree +. +└── unicorn + └── rainbow + └── cake +``` + +Multiple directories: + +```js +const makeDir = require('make-dir'); + +(async () => { + const paths = await Promise.all([ + makeDir('unicorn/rainbow'), + makeDir('foo/bar') + ]); + + console.log(paths); + /* + [ + '/Users/sindresorhus/fun/unicorn/rainbow', + '/Users/sindresorhus/fun/foo/bar' + ] + */ +})(); +``` + + +## API + +### makeDir(path, [options]) + +Returns a `Promise` for the path to the created directory. + +### makeDir.sync(path, [options]) + +Returns the path to the created directory. + +#### path + +Type: `string` + +Directory to create. + +#### options + +Type: `Object` + +##### mode + +Type: `integer`
+Default: `0o777 & (~process.umask())` + +Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + +##### fs + +Type: `Object`
+Default: `require('fs')` + +Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + +Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + + +## Related + +- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module +- [del](https://github.com/sindresorhus/del) - Delete files and directories +- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching +- [cpy](https://github.com/sindresorhus/cpy) - Copy files +- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line +- [move-file](https://github.com/sindresorhus/move-file) - Move a file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/webpack-test/scripts/test-metric-util.js b/webpack-test/scripts/test-metric-util.js index d161657ab91..e5755801e84 100644 --- a/webpack-test/scripts/test-metric-util.js +++ b/webpack-test/scripts/test-metric-util.js @@ -60,8 +60,8 @@ function renderAllTestsToMarkdown(jsonObj) { const testResults = jsonObj["testResults"]; return testResults .flatMap(testSuite => testSuite.assertionResults) - // use 1\. to break GitHub markdown list auto ordering - .map((test, index) => `${index + 1}\. ${renderTestToMarkdown(test.fullName)}`) + // use `1 ` to break GitHub markdown list auto ordering + .map((test, index) => `${index + 1} ${renderTestToMarkdown(test.fullName)}`) .join('\n') } From eb1b19cb92487be81396bf0500300afd5378f780 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Wed, 25 Oct 2023 21:28:25 +0800 Subject: [PATCH 5/5] use correct version css-loader --- pnpm-lock.yaml | 34 +++++++++++++++++++ .../large/many-replacements/test.filter.js | 8 +++-- webpack-test/package.json | 1 + 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 20fa90df9f0..d30b8489010 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1296,6 +1296,7 @@ importers: coffee-loader: ^1.0.0 coffeescript: ^2.5.1 copy-webpack-plugin: '5' + css-loader: ^5.0.1 csv-to-markdown-table: ^1.3.0 enhanced-resolve: 5.12.0 file-loader: ^6.2.0 @@ -1355,6 +1356,7 @@ importers: coffee-loader: 1.0.1_coffeescript@2.7.0 coffeescript: 2.7.0 copy-webpack-plugin: 5.1.2 + css-loader: 5.0.1 csv-to-markdown-table: 1.3.0 file-loader: 6.2.0 is-ci: 3.0.1 @@ -16245,6 +16247,26 @@ packages: resolution: {integrity: sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==} engines: {node: '>=4'} + /css-loader/5.0.1: + resolution: {integrity: sha512-cXc2ti9V234cq7rJzFKhirb2L2iPy8ZjALeVJAozXYz9te3r4eqLSixNAbMDJSgJEQywqXzs8gonxaboeKqwiw==} + engines: {node: '>= 10.13.0'} + peerDependencies: + webpack: ^4.27.0 || ^5.0.0 + dependencies: + camelcase: 6.3.0 + cssesc: 3.0.0 + icss-utils: 5.1.0_postcss@8.4.21 + loader-utils: 2.0.4 + postcss: 8.4.21 + postcss-modules-extract-imports: 3.0.0_postcss@8.4.21 + postcss-modules-local-by-default: 4.0.3_postcss@8.4.21 + postcss-modules-scope: 3.0.0_postcss@8.4.21 + postcss-modules-values: 4.0.0_postcss@8.4.21 + postcss-value-parser: 4.2.0 + schema-utils: 3.1.2 + semver: 7.5.1 + dev: true + /css-loader/6.7.3: resolution: {integrity: sha512-qhOH1KlBMnZP8FzRO6YCH9UHXQhVMcEGLyNdb7Hv2cpcmJbW0YrddO+tG1ab5nT41KpHIYGsbeHqxB9xPu1pKQ==} engines: {node: '>= 12.13.0'} @@ -24124,6 +24146,18 @@ packages: postcss-value-parser: 4.2.0 dev: true + /postcss-modules-local-by-default/4.0.3_postcss@8.4.21: + resolution: {integrity: sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + dependencies: + icss-utils: 5.1.0_postcss@8.4.21 + postcss: 8.4.21 + postcss-selector-parser: 6.0.11 + postcss-value-parser: 4.2.0 + dev: true + /postcss-modules-local-by-default/4.0.3_postcss@8.4.23: resolution: {integrity: sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==} engines: {node: ^10 || ^12 || >= 14} diff --git a/webpack-test/cases/large/many-replacements/test.filter.js b/webpack-test/cases/large/many-replacements/test.filter.js index 71a71e594ff..de62cf5195d 100644 --- a/webpack-test/cases/large/many-replacements/test.filter.js +++ b/webpack-test/cases/large/many-replacements/test.filter.js @@ -1,3 +1,5 @@ -module.exports = function (config) { - return !process.env.CI; -}; +// module.exports = function (config) { +// return !process.env.CI; +// }; + +module.exports = () => false // passed it, but it's too slow diff --git a/webpack-test/package.json b/webpack-test/package.json index ba8e551fa72..174e069950f 100644 --- a/webpack-test/package.json +++ b/webpack-test/package.json @@ -30,6 +30,7 @@ "coffee-loader": "^1.0.0", "coffeescript": "^2.5.1", "copy-webpack-plugin": "5", + "css-loader": "^5.0.1", "csv-to-markdown-table": "^1.3.0", "file-loader": "^6.2.0", "is-ci": "3.0.1",