@rspack/core 0.7.0 → 0.7.1-canary-72a523f-20240530161839

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.
@@ -331,20 +331,31 @@ const cssAutoParserOptions = zod_1.z.strictObject({
331
331
  const cssModuleParserOptions = zod_1.z.strictObject({
332
332
  namedExports: cssParserNamedExports.optional()
333
333
  });
334
- //TODO: "weak", "lazy-once"
335
- const dynamicImportMode = zod_1.z.enum(["eager", "lazy"]);
334
+ const dynamicImportMode = zod_1.z.enum(["eager", "lazy", "weak", "lazy-once"]);
336
335
  const dynamicImportPreload = zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]);
337
336
  const dynamicImportPrefetch = zod_1.z.union([zod_1.z.boolean(), zod_1.z.number()]);
338
337
  const javascriptParserUrl = zod_1.z.union([zod_1.z.literal("relative"), zod_1.z.boolean()]);
339
338
  const exprContextCritical = zod_1.z.boolean();
340
339
  const wrappedContextCritical = zod_1.z.boolean();
340
+ const exportsPresence = zod_1.z.enum(["error", "warn", "auto"]).or(zod_1.z.literal(false));
341
+ const importExportsPresence = zod_1.z
342
+ .enum(["error", "warn", "auto"])
343
+ .or(zod_1.z.literal(false));
344
+ const reexportExportsPresence = zod_1.z
345
+ .enum(["error", "warn", "auto"])
346
+ .or(zod_1.z.literal(false));
347
+ const strictExportPresence = zod_1.z.boolean();
341
348
  const javascriptParserOptions = zod_1.z.strictObject({
342
349
  dynamicImportMode: dynamicImportMode.optional(),
343
350
  dynamicImportPreload: dynamicImportPreload.optional(),
344
351
  dynamicImportPrefetch: dynamicImportPrefetch.optional(),
345
352
  url: javascriptParserUrl.optional(),
346
353
  exprContextCritical: exprContextCritical.optional(),
347
- wrappedContextCritical: wrappedContextCritical.optional()
354
+ wrappedContextCritical: wrappedContextCritical.optional(),
355
+ exportsPresence: exportsPresence.optional(),
356
+ importExportsPresence: importExportsPresence.optional(),
357
+ reexportExportsPresence: reexportExportsPresence.optional(),
358
+ strictExportPresence: strictExportPresence.optional()
348
359
  });
349
360
  const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({
350
361
  asset: assetParserOptions.optional(),
@@ -585,6 +596,7 @@ const nodeOptions = zod_1.z.strictObject({
585
596
  global: zod_1.z.boolean().or(zod_1.z.literal("warn")).optional()
586
597
  });
587
598
  const node = zod_1.z.literal(false).or(nodeOptions);
599
+ const loader = zod_1.z.record(zod_1.z.string(), zod_1.z.any());
588
600
  //#endregion
589
601
  //#region Snapshot
590
602
  const snapshotOptions = zod_1.z.strictObject({});
@@ -828,6 +840,7 @@ exports.rspackOptions = zod_1.z.strictObject({
828
840
  context: context.optional(),
829
841
  devtool: devTool.optional(),
830
842
  node: node.optional(),
843
+ loader: loader.optional(),
831
844
  ignoreWarnings: ignoreWarnings.optional(),
832
845
  watchOptions: watchOptions.optional(),
833
846
  watch: watch.optional(),
@@ -132,6 +132,5 @@ function getDefaultEntryRuntime(paths, options, compiler) {
132
132
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
133
133
  compiler.webpack.Template.getFunctionContent(require("./default.runtime"))
134
134
  ].join("\n");
135
- // use "data:text/javascript" to use moduleType "javascript/auto"
136
- return `data:text/javascript,${content}`;
135
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
137
136
  }
@@ -19,12 +19,12 @@ const identifier_1 = require("../util/identifier");
19
19
  const memoize_1 = require("../util/memoize");
20
20
  const loadLoader = require("./loadLoader");
21
21
  const querystring = require("node:querystring");
22
- const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
22
+ const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
23
23
  function parsePathQueryFragment(str) {
24
24
  const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
25
25
  return {
26
- path: match?.[1].replace(/\0(.)/g, "$1") || "",
27
- query: match?.[2] ? match[2].replace(/\0(.)/g, "$1") : "",
26
+ path: match?.[1].replace(/\u200b(.)/g, "$1") || "",
27
+ query: match?.[2] ? match[2].replace(/\u200b(.)/g, "$1") : "",
28
28
  fragment: match?.[3] || ""
29
29
  };
30
30
  }
@@ -61,8 +61,8 @@ function createLoaderObject(loader, compiler) {
61
61
  Object.defineProperty(obj, "request", {
62
62
  enumerable: true,
63
63
  get: function () {
64
- return (obj.path.replace(/#/g, "\0#") +
65
- obj.query.replace(/#/g, "\0#") +
64
+ return (obj.path.replace(/#/g, "\u200b#") +
65
+ obj.query.replace(/#/g, "\u200b#") +
66
66
  obj.fragment);
67
67
  },
68
68
  set: function (value) {
@@ -253,8 +253,8 @@ async function runLoaders(compiler, rawContext) {
253
253
  get: function () {
254
254
  if (loaderContext.resourcePath === undefined)
255
255
  return undefined;
256
- return (loaderContext.resourcePath.replace(/#/g, "\0#") +
257
- loaderContext.resourceQuery.replace(/#/g, "\0#") +
256
+ return (loaderContext.resourcePath.replace(/#/g, "\u200b#") +
257
+ loaderContext.resourceQuery.replace(/#/g, "\u200b#") +
258
258
  loaderContext.resourceFragment);
259
259
  },
260
260
  set: function (value) {
@@ -339,6 +339,7 @@ async function runLoaders(compiler, rawContext) {
339
339
  ? (0, adapterRuleUse_1.isUseSourceMap)(compiler.options.devtool)
340
340
  : false;
341
341
  loaderContext.mode = compiler.options.mode;
342
+ Object.assign(loaderContext, compiler.options.loader);
342
343
  const getResolveContext = () => {
343
344
  // FIXME: resolve's fileDependencies will includes lots of dir, '/', etc
344
345
  return {
@@ -287,8 +287,8 @@ const _absolutify = (context, request) => {
287
287
  };
288
288
  const absolutify = makeCacheableWithContext(_absolutify);
289
289
  exports.absolutify = absolutify;
290
- const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
291
- const PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/;
290
+ const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
291
+ const PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
292
292
  /** @typedef {{ resource: string, path: string, query: string, fragment: string }} ParsedResource */
293
293
  /** @typedef {{ resource: string, path: string, query: string }} ParsedResourceWithoutFragment */
294
294
  /**
@@ -300,9 +300,9 @@ const _parseResource = str => {
300
300
  return {
301
301
  resource: str,
302
302
  // @ts-expect-error
303
- path: match[1].replace(/\0(.)/g, "$1"),
303
+ path: match[1].replace(/\u200b(.)/g, "$1"),
304
304
  // @ts-expect-error
305
- query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "",
305
+ query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : "",
306
306
  // @ts-expect-error
307
307
  fragment: match[3] || ""
308
308
  };
@@ -318,9 +318,9 @@ const _parseResourceWithoutFragment = str => {
318
318
  return {
319
319
  resource: str,
320
320
  // @ts-expect-error
321
- path: match[1].replace(/\0(.)/g, "$1"),
321
+ path: match[1].replace(/\u200b(.)/g, "$1"),
322
322
  // @ts-expect-error
323
- query: match[2] ? match[2].replace(/\0(.)/g, "$1") : ""
323
+ query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
324
324
  };
325
325
  };
326
326
  exports.parseResourceWithoutFragment = makeCacheable(_parseResourceWithoutFragment);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.1-canary-72a523f-20240530161839",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -72,15 +72,15 @@
72
72
  "watchpack": "^2.4.0",
73
73
  "zod": "^3.21.4",
74
74
  "zod-validation-error": "1.3.1",
75
- "@rspack/core": "0.7.0",
76
- "@rspack/plugin-minify": "^0.7.0"
75
+ "@rspack/core": "0.7.1-canary-72a523f-20240530161839",
76
+ "@rspack/plugin-minify": "^0.7.1-canary-72a523f-20240530161839"
77
77
  },
78
78
  "dependencies": {
79
79
  "@module-federation/runtime-tools": "0.1.6",
80
80
  "caniuse-lite": "^1.0.30001616",
81
81
  "tapable": "2.2.1",
82
82
  "webpack-sources": "3.2.3",
83
- "@rspack/binding": "0.7.0"
83
+ "@rspack/binding": "0.7.1-canary-72a523f-20240530161839"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"