@rspack/core 0.7.0-canary-7e3a2e5-20240529004417 → 0.7.0-canary-93a5923-20240531004011
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin-plugin/css-extract/loader-options.json +5 -0
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -0
- package/dist/builtin-plugin/css-extract/loader.js +33 -10
- package/dist/config/adapter.js +9 -1
- package/dist/config/defaults.js +4 -0
- package/dist/config/zod.d.ts +535 -107
- package/dist/config/zod.js +14 -3
- package/dist/container/ModuleFederationPlugin.js +1 -2
- package/dist/loader-runner/index.js +7 -7
- package/dist/util/identifier.js +6 -6
- package/package.json +4 -4
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"layer": {
|
|
29
29
|
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"defaultExport": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "Duplicate the named export with CSS modules locals to the default export (only when `esModules: true` for css-loader).",
|
|
34
|
+
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#defaultexports"
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -133,16 +133,39 @@ const pitch = function (request, _, data) {
|
|
|
133
133
|
callback(e);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
const result =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
const result = (function makeResult() {
|
|
137
|
+
if (locals) {
|
|
138
|
+
if (namedExport) {
|
|
139
|
+
const identifiers = Array.from((function* generateIdentifiers() {
|
|
140
|
+
let identifierId = 0;
|
|
141
|
+
for (const key of Object.keys(locals)) {
|
|
142
|
+
identifierId += 1;
|
|
143
|
+
yield [`_${identifierId.toString(16)}`, key];
|
|
144
|
+
}
|
|
145
|
+
})());
|
|
146
|
+
const localsString = identifiers
|
|
147
|
+
.map(([id, key]) => `\nvar ${id} = ${(0, utils_1.stringifyLocal)(
|
|
148
|
+
/** @type {Locals} */ locals[key])};`)
|
|
149
|
+
.join("");
|
|
150
|
+
const exportsString = `export { ${identifiers
|
|
151
|
+
.map(([id, key]) => `${id} as ${JSON.stringify(key)}`)
|
|
152
|
+
.join(", ")} }`;
|
|
153
|
+
const defaultExport = typeof options.defaultExport !== "undefined"
|
|
154
|
+
? options.defaultExport
|
|
155
|
+
: false;
|
|
156
|
+
return defaultExport
|
|
157
|
+
? `${localsString}\n${exportsString}\nexport default { ${identifiers
|
|
158
|
+
.map(([id, key]) => `${JSON.stringify(key)}: ${id}`)
|
|
159
|
+
.join(", ")} }\n`
|
|
160
|
+
: `${localsString}\n${exportsString}\n`;
|
|
161
|
+
}
|
|
162
|
+
return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
|
|
163
|
+
}
|
|
164
|
+
else if (esModule) {
|
|
165
|
+
return "\nexport {};";
|
|
166
|
+
}
|
|
167
|
+
return "";
|
|
168
|
+
})();
|
|
146
169
|
let resultSource = `// extracted by ${index_1.CssExtractRspackPlugin.pluginName}`;
|
|
147
170
|
// only attempt hotreloading if the css is actually used for something other than hash values
|
|
148
171
|
resultSource +=
|
package/dist/config/adapter.js
CHANGED
|
@@ -457,7 +457,15 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
457
457
|
? parser.url
|
|
458
458
|
: "true",
|
|
459
459
|
exprContextCritical: parser.exprContextCritical ?? true,
|
|
460
|
-
wrappedContextCritical: parser.wrappedContextCritical ?? false
|
|
460
|
+
wrappedContextCritical: parser.wrappedContextCritical ?? false,
|
|
461
|
+
exportsPresence: parser.exportsPresence === false ? "false" : parser.exportsPresence,
|
|
462
|
+
importExportsPresence: parser.importExportsPresence === false
|
|
463
|
+
? "false"
|
|
464
|
+
: parser.importExportsPresence,
|
|
465
|
+
reexportExportsPresence: parser.reexportExportsPresence === false
|
|
466
|
+
? "false"
|
|
467
|
+
: parser.reexportExportsPresence,
|
|
468
|
+
strictExportPresence: parser.strictExportPresence ?? false
|
|
461
469
|
};
|
|
462
470
|
}
|
|
463
471
|
function getRawAssetParserOptions(parser) {
|
package/dist/config/defaults.js
CHANGED
|
@@ -143,6 +143,10 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
|
|
|
143
143
|
D(parserOptions, "url", fallback?.url ?? true);
|
|
144
144
|
D(parserOptions, "exprContextCritical", fallback?.exprContextCritical ?? true);
|
|
145
145
|
D(parserOptions, "wrappedContextCritical", fallback?.wrappedContextCritical ?? false);
|
|
146
|
+
D(parserOptions, "exportsPresence", fallback?.exportsPresence);
|
|
147
|
+
D(parserOptions, "importExportsPresence", fallback?.importExportsPresence);
|
|
148
|
+
D(parserOptions, "reexportExportsPresence", fallback?.reexportExportsPresence);
|
|
149
|
+
D(parserOptions, "strictExportPresence", fallback?.strictExportPresence ?? false);
|
|
146
150
|
};
|
|
147
151
|
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
|
|
148
152
|
(0, assertNotNil_1.assertNotNill)(module.parser);
|