@rspack/core 0.7.5-canary-9ec73cf-20240620092522 → 0.7.5-canary-129960e-20240620181737

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.
@@ -85,21 +85,24 @@ function getRawResolveByDependency(byDependency) {
85
85
  return byDependency;
86
86
  return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)]));
87
87
  }
88
+ function getRawTsConfig(tsConfig) {
89
+ (0, assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization");
90
+ if (tsConfig === undefined)
91
+ return tsConfig;
92
+ const { configFile, references } = tsConfig;
93
+ return {
94
+ configFile,
95
+ referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
96
+ references: references == "auto" ? undefined : references
97
+ };
98
+ }
88
99
  function getRawResolve(resolve) {
89
- let references = resolve.tsConfig?.references;
90
- let tsconfigConfigFile = resolve.tsConfigPath ?? resolve.tsConfig?.configFile;
91
100
  return {
92
101
  ...resolve,
93
102
  alias: getRawAlias(resolve.alias),
94
103
  fallback: getRawAlias(resolve.fallback),
95
104
  extensionAlias: getRawExtensionAlias(resolve.extensionAlias),
96
- tsconfig: tsconfigConfigFile
97
- ? {
98
- configFile: tsconfigConfigFile,
99
- referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
100
- references: references == "auto" ? undefined : references
101
- }
102
- : undefined,
105
+ tsconfig: getRawTsConfig(resolve.tsConfig),
103
106
  byDependency: getRawResolveByDependency(resolve.byDependency)
104
107
  };
105
108
  }
@@ -16,20 +16,9 @@ exports.createRawModuleRuleUses = createRawModuleRuleUses;
16
16
  const getSwcLoaderOptions = (o, options) => {
17
17
  if (o && typeof o === "object" && o.rspackExperiments) {
18
18
  let expr = o.rspackExperiments;
19
- const contextPath = options.context;
20
- const production = options.mode === "production" || !options.mode;
21
- if (expr.emotion) {
22
- expr.emotion = (0, builtin_loader_1.resolveEmotion)(expr.emotion, production);
23
- }
24
- if (expr.relay) {
25
- expr.relay = (0, builtin_loader_1.resolveRelay)(expr.relay, contextPath);
26
- }
27
19
  if (expr.import || expr.pluginImport) {
28
20
  expr.import = (0, builtin_loader_1.resolvePluginImport)(expr.import || expr.pluginImport);
29
21
  }
30
- if (expr.react) {
31
- expr.react = (0, builtin_loader_1.resolveReact)(expr.react);
32
- }
33
22
  if (expr.preact) {
34
23
  expr.preact = (0, builtin_loader_1.resolvePreact)(expr.preact);
35
24
  }
@@ -123,10 +123,20 @@ const getNormalizedRspackOptions = (config) => {
123
123
  };
124
124
  }),
125
125
  resolve: nestedConfig(config.resolve, resolve => ({
126
- ...resolve
126
+ ...resolve,
127
+ tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
128
+ return typeof tsConfig === "string"
129
+ ? { configFile: tsConfig }
130
+ : tsConfig;
131
+ })
127
132
  })),
128
133
  resolveLoader: nestedConfig(config.resolveLoader, resolve => ({
129
- ...resolve
134
+ ...resolve,
135
+ tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
136
+ return typeof tsConfig === "string"
137
+ ? { configFile: tsConfig }
138
+ : tsConfig;
139
+ })
130
140
  })),
131
141
  module: nestedConfig(config.module, module => ({
132
142
  noParse: module.noParse,
@@ -1431,7 +1431,7 @@ declare const output: z.ZodObject<{
1431
1431
  export type Output = z.infer<typeof output>;
1432
1432
  declare const resolveAlias: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>, "many">]>>;
1433
1433
  export type ResolveAlias = z.infer<typeof resolveAlias>;
1434
- declare const resolveTsconfig: z.ZodObject<{
1434
+ declare const resolveTsConfig: z.ZodUnion<[z.ZodString, z.ZodObject<{
1435
1435
  configFile: z.ZodString;
1436
1436
  references: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodLiteral<"auto">]>>;
1437
1437
  }, "strict", z.ZodTypeAny, {
@@ -1440,8 +1440,8 @@ declare const resolveTsconfig: z.ZodObject<{
1440
1440
  }, {
1441
1441
  configFile: string;
1442
1442
  references?: string[] | "auto" | undefined;
1443
- }>;
1444
- export type ResolveTsconfig = z.infer<typeof resolveTsconfig>;
1443
+ }>]>;
1444
+ export type ResolveTsConfig = z.infer<typeof resolveTsConfig>;
1445
1445
  declare const baseResolveOptions: z.ZodObject<{
1446
1446
  alias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>, "many">]>>>;
1447
1447
  conditionNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1456,8 +1456,7 @@ declare const baseResolveOptions: z.ZodObject<{
1456
1456
  enforceExtension: z.ZodOptional<z.ZodBoolean>;
1457
1457
  importsFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1458
1458
  descriptionFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1459
- tsConfigPath: z.ZodOptional<z.ZodString>;
1460
- tsConfig: z.ZodOptional<z.ZodObject<{
1459
+ tsConfig: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
1461
1460
  configFile: z.ZodString;
1462
1461
  references: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodLiteral<"auto">]>>;
1463
1462
  }, "strict", z.ZodTypeAny, {
@@ -1466,7 +1465,7 @@ declare const baseResolveOptions: z.ZodObject<{
1466
1465
  }, {
1467
1466
  configFile: string;
1468
1467
  references?: string[] | "auto" | undefined;
1469
- }>>;
1468
+ }>]>>;
1470
1469
  fullySpecified: z.ZodOptional<z.ZodBoolean>;
1471
1470
  exportsFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1472
1471
  extensionAlias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
@@ -1487,8 +1486,7 @@ declare const baseResolveOptions: z.ZodObject<{
1487
1486
  enforceExtension?: boolean | undefined;
1488
1487
  importsFields?: string[] | undefined;
1489
1488
  descriptionFiles?: string[] | undefined;
1490
- tsConfigPath?: string | undefined;
1491
- tsConfig?: {
1489
+ tsConfig?: string | {
1492
1490
  configFile: string;
1493
1491
  references?: string[] | "auto" | undefined;
1494
1492
  } | undefined;
@@ -1512,8 +1510,7 @@ declare const baseResolveOptions: z.ZodObject<{
1512
1510
  enforceExtension?: boolean | undefined;
1513
1511
  importsFields?: string[] | undefined;
1514
1512
  descriptionFiles?: string[] | undefined;
1515
- tsConfigPath?: string | undefined;
1516
- tsConfig?: {
1513
+ tsConfig?: string | {
1517
1514
  configFile: string;
1518
1515
  references?: string[] | "auto" | undefined;
1519
1516
  } | undefined;
@@ -230,10 +230,11 @@ const resolveAlias = zod_1.z.record(zod_1.z
230
230
  .literal(false)
231
231
  .or(zod_1.z.string())
232
232
  .or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false)))));
233
- const resolveTsconfig = zod_1.z.strictObject({
234
- configFile: zod_1.z.string(),
233
+ const resolveTsConfigFile = zod_1.z.string();
234
+ const resolveTsConfig = resolveTsConfigFile.or(zod_1.z.strictObject({
235
+ configFile: resolveTsConfigFile,
235
236
  references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal("auto")).optional()
236
- });
237
+ }));
237
238
  const baseResolveOptions = zod_1.z.strictObject({
238
239
  alias: resolveAlias.optional(),
239
240
  conditionNames: zod_1.z.array(zod_1.z.string()).optional(),
@@ -248,8 +249,7 @@ const baseResolveOptions = zod_1.z.strictObject({
248
249
  enforceExtension: zod_1.z.boolean().optional(),
249
250
  importsFields: zod_1.z.array(zod_1.z.string()).optional(),
250
251
  descriptionFiles: zod_1.z.array(zod_1.z.string()).optional(),
251
- tsConfigPath: zod_1.z.string().optional(),
252
- tsConfig: resolveTsconfig.optional(),
252
+ tsConfig: resolveTsConfig.optional(),
253
253
  fullySpecified: zod_1.z.boolean().optional(),
254
254
  exportsFields: zod_1.z.array(zod_1.z.string()).optional(),
255
255
  extensionAlias: zod_1.z.record(zod_1.z.string().or(zod_1.z.array(zod_1.z.string()))).optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.5-canary-9ec73cf-20240620092522",
3
+ "version": "0.7.5-canary-129960e-20240620181737",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -74,15 +74,15 @@
74
74
  "watchpack": "^2.4.0",
75
75
  "zod": "^3.21.4",
76
76
  "zod-validation-error": "1.3.1",
77
- "@rspack/core": "0.7.5-canary-9ec73cf-20240620092522",
78
- "@rspack/plugin-minify": "^0.7.5-canary-9ec73cf-20240620092522"
77
+ "@rspack/core": "0.7.5-canary-129960e-20240620181737",
78
+ "@rspack/plugin-minify": "^0.7.5-canary-129960e-20240620181737"
79
79
  },
80
80
  "dependencies": {
81
81
  "@module-federation/runtime-tools": "0.1.6",
82
82
  "caniuse-lite": "^1.0.30001616",
83
83
  "tapable": "2.2.1",
84
84
  "webpack-sources": "3.2.3",
85
- "@rspack/binding": "0.7.5-canary-9ec73cf-20240620092522"
85
+ "@rspack/binding": "0.7.5-canary-129960e-20240620181737"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@swc/helpers": ">=0.5.1"