@rspack/core 0.7.5-canary-910259c-20240624004455 → 0.7.5-canary-1ab2ea8-20240624100353
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/Chunk.d.ts +1 -1
- package/dist/builtin-loader/swc/index.d.ts +0 -4
- package/dist/builtin-loader/swc/index.js +1 -5
- package/dist/builtin-loader/swc/preact.d.ts +3 -4
- package/dist/builtin-loader/swc/types.d.ts +2 -17
- package/dist/stats/DefaultStatsFactoryPlugin.js +19 -2
- package/dist/stats/statsFactoryUtils.d.ts +4 -2
- package/package.json +8 -4
- package/dist/builtin-loader/swc/emotion.d.ts +0 -17
- package/dist/builtin-loader/swc/emotion.js +0 -22
- package/dist/builtin-loader/swc/relay.d.ts +0 -5
- package/dist/builtin-loader/swc/relay.js +0 -48
package/dist/Chunk.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class Chunk {
|
|
|
14
14
|
hash?: Readonly<string>;
|
|
15
15
|
contentHash: Readonly<Record<string, string>>;
|
|
16
16
|
renderedHash?: Readonly<string>;
|
|
17
|
-
chunkReason
|
|
17
|
+
chunkReason?: Readonly<string>;
|
|
18
18
|
auxiliaryFiles: ReadonlySet<string>;
|
|
19
19
|
static __from_binding(chunk: JsChunk, compilation: Compilation): Chunk;
|
|
20
20
|
static __from_binding(chunk: JsChunk, compilation: JsCompilation): Chunk;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export type { EmotionOptions } from "./emotion";
|
|
2
|
-
export { resolveEmotion } from "./emotion";
|
|
3
1
|
export { resolvePluginImport } from "./pluginImport";
|
|
4
2
|
export type { PluginImportOptions } from "./pluginImport";
|
|
5
3
|
export type { ReactOptions } from "./react";
|
|
6
4
|
export { resolveReact } from "./react";
|
|
7
5
|
export { resolvePreact } from "./preact";
|
|
8
6
|
export type { PreactOptions } from "./preact";
|
|
9
|
-
export type { RelayOptions } from "./relay";
|
|
10
|
-
export { resolveRelay } from "./relay";
|
|
11
7
|
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./types";
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var emotion_1 = require("./emotion");
|
|
5
|
-
Object.defineProperty(exports, "resolveEmotion", { enumerable: true, get: function () { return emotion_1.resolveEmotion; } });
|
|
3
|
+
exports.resolvePreact = exports.resolveReact = exports.resolvePluginImport = void 0;
|
|
6
4
|
var pluginImport_1 = require("./pluginImport");
|
|
7
5
|
Object.defineProperty(exports, "resolvePluginImport", { enumerable: true, get: function () { return pluginImport_1.resolvePluginImport; } });
|
|
8
6
|
var react_1 = require("./react");
|
|
9
7
|
Object.defineProperty(exports, "resolveReact", { enumerable: true, get: function () { return react_1.resolveReact; } });
|
|
10
8
|
var preact_1 = require("./preact");
|
|
11
9
|
Object.defineProperty(exports, "resolvePreact", { enumerable: true, get: function () { return preact_1.resolvePreact; } });
|
|
12
|
-
var relay_1 = require("./relay");
|
|
13
|
-
Object.defineProperty(exports, "resolveRelay", { enumerable: true, get: function () { return relay_1.resolveRelay; } });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
type RawPreactOptions = {
|
|
2
2
|
library?: string;
|
|
3
3
|
};
|
|
4
|
-
type PreactOptions = RawPreactOptions | boolean | undefined;
|
|
5
|
-
declare function resolvePreact(preact: PreactOptions): RawPreactOptions | undefined;
|
|
6
|
-
export {
|
|
7
|
-
export type { PreactOptions };
|
|
4
|
+
export type PreactOptions = RawPreactOptions | boolean | undefined;
|
|
5
|
+
export declare function resolvePreact(preact: PreactOptions): RawPreactOptions | undefined;
|
|
6
|
+
export {};
|
|
@@ -2,22 +2,9 @@
|
|
|
2
2
|
* Some types are modified from https://github.com/swc-project/swc/blob/16a38851/packages/types/index.ts#L647
|
|
3
3
|
* license at https://github.com/swc-project/swc/blob/main/LICENSE
|
|
4
4
|
*/
|
|
5
|
-
import type { EmotionOptions } from "./emotion";
|
|
6
5
|
import type { PluginImportOptions } from "./pluginImport";
|
|
6
|
+
import type { PreactOptions } from "./preact";
|
|
7
7
|
import type { ReactOptions } from "./react";
|
|
8
|
-
import type { RelayOptions } from "./relay";
|
|
9
|
-
export type StyledComponentsOptions = {
|
|
10
|
-
displayName?: boolean;
|
|
11
|
-
ssr?: boolean;
|
|
12
|
-
fileName?: boolean;
|
|
13
|
-
meaninglessFileNames?: string[];
|
|
14
|
-
namespace?: string;
|
|
15
|
-
topLevelImportPaths?: string[];
|
|
16
|
-
transpileTemplateLiterals?: boolean;
|
|
17
|
-
minify?: boolean;
|
|
18
|
-
pure?: boolean;
|
|
19
|
-
cssProps?: boolean;
|
|
20
|
-
};
|
|
21
8
|
export type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
|
|
22
9
|
export type SwcLoaderParserConfig = SwcLoaderTsParserConfig | SwcLoaderEsParserConfig;
|
|
23
10
|
export interface SwcLoaderTsParserConfig {
|
|
@@ -454,9 +441,7 @@ export type SwcLoaderOptions = {
|
|
|
454
441
|
* @experimental
|
|
455
442
|
*/
|
|
456
443
|
rspackExperiments?: {
|
|
457
|
-
relay?: RelayOptions;
|
|
458
|
-
emotion?: EmotionOptions;
|
|
459
444
|
import?: PluginImportOptions;
|
|
460
|
-
|
|
445
|
+
preact?: PreactOptions;
|
|
461
446
|
};
|
|
462
447
|
};
|
|
@@ -277,13 +277,23 @@ const SORTERS = {
|
|
|
277
277
|
_: comparators => {
|
|
278
278
|
comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
|
|
279
279
|
}
|
|
280
|
-
}
|
|
280
|
+
},
|
|
281
281
|
// "compilation.modules": MODULES_SORTER,
|
|
282
282
|
// "chunk.rootModules": MODULES_SORTER,
|
|
283
283
|
// "chunk.modules": MODULES_SORTER,
|
|
284
284
|
// "module.modules": MODULES_SORTER,
|
|
285
285
|
// not support module.reasons (missing Module.identifier())
|
|
286
|
-
|
|
286
|
+
"chunk.origins": {
|
|
287
|
+
_: comparators => {
|
|
288
|
+
comparators.push(
|
|
289
|
+
// compareSelect(
|
|
290
|
+
// origin =>
|
|
291
|
+
// origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
292
|
+
// compareIds
|
|
293
|
+
// ),
|
|
294
|
+
(0, comparators_1.compareSelect)((origin) => origin.loc, compareIds), (0, comparators_1.compareSelect)((origin) => origin.request, compareIds));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
287
297
|
};
|
|
288
298
|
const SIMPLE_EXTRACTORS = {
|
|
289
299
|
compilation: {
|
|
@@ -708,6 +718,10 @@ const SIMPLE_EXTRACTORS = {
|
|
|
708
718
|
object.files = chunk.files;
|
|
709
719
|
object.auxiliaryFiles = chunk.auxiliaryFiles;
|
|
710
720
|
object.childrenByOrder = chunk.childrenByOrder;
|
|
721
|
+
object.runtime = chunk.runtime;
|
|
722
|
+
object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size }) => [sourceType, size]));
|
|
723
|
+
object.reason = chunk.reason;
|
|
724
|
+
object.rendered = chunk.rendered;
|
|
711
725
|
},
|
|
712
726
|
ids: (object, chunk) => {
|
|
713
727
|
object.id = chunk.id;
|
|
@@ -720,6 +734,9 @@ const SIMPLE_EXTRACTORS = {
|
|
|
720
734
|
chunkModules: (object, chunk, context, options, factory) => {
|
|
721
735
|
const { type } = context;
|
|
722
736
|
object.modules = factory.create(`${type}.modules`, chunk.modules, context);
|
|
737
|
+
},
|
|
738
|
+
chunkOrigins: (object, chunk, context, options, factory) => {
|
|
739
|
+
object.origins = chunk.origins;
|
|
723
740
|
}
|
|
724
741
|
}
|
|
725
742
|
};
|
|
@@ -3,7 +3,9 @@ import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
|
3
3
|
import { type Comparator } from "../util/comparators";
|
|
4
4
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
5
5
|
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
|
|
6
|
-
export type KnownStatsChunk = binding.JsStatsChunk
|
|
6
|
+
export type KnownStatsChunk = Omit<binding.JsStatsChunk, "sizes"> & {
|
|
7
|
+
sizes: Record<string, number>;
|
|
8
|
+
};
|
|
7
9
|
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
8
10
|
export type KnownStatsAsset = binding.JsStatsAsset;
|
|
9
11
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
@@ -95,7 +97,7 @@ export type SimpleExtractors = {
|
|
|
95
97
|
moduleIssuer: ExtractorsByOption<binding.JsStatsModuleIssuer, StatsModuleIssuer>;
|
|
96
98
|
profile: ExtractorsByOption<binding.JsStatsModuleProfile, StatsProfile>;
|
|
97
99
|
moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
|
|
98
|
-
chunk: ExtractorsByOption<
|
|
100
|
+
chunk: ExtractorsByOption<binding.JsStatsChunk, KnownStatsChunk>;
|
|
99
101
|
};
|
|
100
102
|
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
|
|
101
103
|
export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.5-canary-
|
|
3
|
+
"version": "0.7.5-canary-1ab2ea8-20240624100353",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"provenance": true
|
|
12
|
+
},
|
|
9
13
|
"exports": {
|
|
10
14
|
".": {
|
|
11
15
|
"default": "./dist/index.js"
|
|
@@ -74,15 +78,15 @@
|
|
|
74
78
|
"watchpack": "^2.4.0",
|
|
75
79
|
"zod": "^3.21.4",
|
|
76
80
|
"zod-validation-error": "1.3.1",
|
|
77
|
-
"@rspack/
|
|
78
|
-
"@rspack/
|
|
81
|
+
"@rspack/plugin-minify": "^0.7.5-canary-1ab2ea8-20240624100353",
|
|
82
|
+
"@rspack/core": "0.7.5-canary-1ab2ea8-20240624100353"
|
|
79
83
|
},
|
|
80
84
|
"dependencies": {
|
|
81
85
|
"@module-federation/runtime-tools": "0.1.6",
|
|
82
86
|
"caniuse-lite": "^1.0.30001616",
|
|
83
87
|
"tapable": "2.2.1",
|
|
84
88
|
"webpack-sources": "3.2.3",
|
|
85
|
-
"@rspack/binding": "0.7.5-canary-
|
|
89
|
+
"@rspack/binding": "0.7.5-canary-1ab2ea8-20240624100353"
|
|
86
90
|
},
|
|
87
91
|
"peerDependencies": {
|
|
88
92
|
"@swc/helpers": ">=0.5.1"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type EmotionConfigImportMap = {
|
|
2
|
-
[packageName: string]: {
|
|
3
|
-
[exportName: string]: {
|
|
4
|
-
canonicalImport?: [string, string];
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
type EmotionConfig = {
|
|
9
|
-
sourceMap?: boolean;
|
|
10
|
-
autoLabel?: "never" | "dev-only" | "always";
|
|
11
|
-
labelFormat?: string;
|
|
12
|
-
importMap?: EmotionConfigImportMap;
|
|
13
|
-
};
|
|
14
|
-
type EmotionOptions = boolean | EmotionConfig | undefined;
|
|
15
|
-
declare function resolveEmotion(emotion: EmotionOptions, isProduction: boolean): EmotionConfig | undefined;
|
|
16
|
-
export { resolveEmotion };
|
|
17
|
-
export type { EmotionOptions };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveEmotion = void 0;
|
|
4
|
-
function resolveEmotion(emotion, isProduction) {
|
|
5
|
-
if (!emotion) {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
if (emotion === true) {
|
|
9
|
-
emotion = {};
|
|
10
|
-
}
|
|
11
|
-
const autoLabel = emotion?.autoLabel ?? "dev-only";
|
|
12
|
-
const emotionConfig = {
|
|
13
|
-
enabled: true,
|
|
14
|
-
// @ts-expect-error autoLabel is string for JavaScript interface, however is boolean for Rust interface
|
|
15
|
-
autoLabel: autoLabel === "dev-only" ? !isProduction : autoLabel === "always",
|
|
16
|
-
importMap: emotion?.importMap,
|
|
17
|
-
labelFormat: emotion?.labelFormat ?? "[local]",
|
|
18
|
-
sourcemap: isProduction ? false : emotion?.sourceMap ?? true
|
|
19
|
-
};
|
|
20
|
-
return emotionConfig;
|
|
21
|
-
}
|
|
22
|
-
exports.resolveEmotion = resolveEmotion;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RawRelayConfig } from "@rspack/binding";
|
|
2
|
-
type RelayOptions = boolean | RawRelayConfig | undefined;
|
|
3
|
-
declare function resolveRelay(relay: RelayOptions, rootDir: string): RawRelayConfig | undefined;
|
|
4
|
-
export { resolveRelay };
|
|
5
|
-
export type { RelayOptions };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveRelay = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
function getRelayConfigFromProject(rootDir) {
|
|
9
|
-
for (const configName of [
|
|
10
|
-
"relay.config.json",
|
|
11
|
-
"relay.config.js",
|
|
12
|
-
"package.json"
|
|
13
|
-
]) {
|
|
14
|
-
const configPath = path_1.default.join(rootDir, configName);
|
|
15
|
-
try {
|
|
16
|
-
let config = require(configPath);
|
|
17
|
-
let finalConfig;
|
|
18
|
-
if (configName === "package.json") {
|
|
19
|
-
finalConfig = config?.relay;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
finalConfig = config;
|
|
23
|
-
}
|
|
24
|
-
if (finalConfig) {
|
|
25
|
-
return {
|
|
26
|
-
language: finalConfig.language,
|
|
27
|
-
artifactDirectory: finalConfig.artifactDirectory
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (_) { }
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function resolveRelay(relay, rootDir) {
|
|
35
|
-
if (!relay) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
// Search relay config based on
|
|
39
|
-
if (relay === true) {
|
|
40
|
-
return (getRelayConfigFromProject(rootDir) || {
|
|
41
|
-
language: "javascript"
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return relay;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.resolveRelay = resolveRelay;
|