@rspack/core 1.0.0-beta.4 → 1.0.0-beta.5
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/NormalModule.d.ts +2 -1
- package/dist/NormalModule.js +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +41 -10
- package/dist/builtin-plugin/HtmlRspackPlugin.js +16 -4
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +1 -7
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +2 -10
- package/dist/builtin-plugin/index.d.ts +0 -1
- package/dist/builtin-plugin/index.js +0 -1
- package/dist/config/adapterRuleUse.d.ts +1 -0
- package/dist/config/adapterRuleUse.js +2 -6
- package/dist/config/defaults.js +13 -7
- package/dist/exports.d.ts +0 -1
- package/dist/exports.js +7 -10
- package/dist/loader-runner/index.js +3 -3
- package/dist/node/NodeWatchFileSystem.d.ts +3 -3
- package/dist/node/NodeWatchFileSystem.js +6 -6
- package/dist/util/fs.d.ts +245 -22
- package/package.json +3 -3
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +0 -16
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +0 -12
package/dist/NormalModule.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
3
3
|
import { Compilation } from "./Compilation";
|
|
4
|
+
import type { Module } from "./Module";
|
|
4
5
|
import type { LoaderContext } from "./config";
|
|
5
6
|
export declare class NormalModule {
|
|
6
7
|
static getCompilationHooks(compilation: Compilation): {
|
|
7
|
-
loader: liteTapable.SyncHook<[LoaderContext<{}
|
|
8
|
+
loader: liteTapable.SyncHook<[LoaderContext<{}>, Module], void, {
|
|
8
9
|
_UnsetAdditionalOptions: true;
|
|
9
10
|
}>;
|
|
10
11
|
readResourceForScheme: any;
|
package/dist/NormalModule.js
CHANGED
|
@@ -76,7 +76,7 @@ class NormalModule {
|
|
|
76
76
|
let hooks = compilationHooksMap.get(compilation);
|
|
77
77
|
if (hooks === undefined) {
|
|
78
78
|
hooks = {
|
|
79
|
-
loader: new liteTapable.SyncHook(["loaderContext"]),
|
|
79
|
+
loader: new liteTapable.SyncHook(["loaderContext", "module"]),
|
|
80
80
|
// TODO webpack 6 deprecate
|
|
81
81
|
readResourceForScheme: new liteTapable.HookMap(scheme => {
|
|
82
82
|
const hook = hooks.readResource.for(scheme);
|
|
@@ -7,24 +7,40 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
7
7
|
templateParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
8
8
|
inject: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["head", "body"]>, z.ZodBoolean]>>;
|
|
9
9
|
publicPath: z.ZodOptional<z.ZodString>;
|
|
10
|
-
|
|
10
|
+
base: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
11
|
+
href: z.ZodOptional<z.ZodString>;
|
|
12
|
+
target: z.ZodOptional<z.ZodEnum<["_self", "_blank", "_parent", "_top"]>>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
15
|
+
href?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
18
|
+
href?: string | undefined;
|
|
19
|
+
}>]>>;
|
|
20
|
+
scriptLoading: z.ZodOptional<z.ZodEnum<["blocking", "defer", "module", "systemjs-module"]>>;
|
|
11
21
|
chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
-
|
|
22
|
+
excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
23
|
sri: z.ZodOptional<z.ZodEnum<["sha256", "sha384", "sha512"]>>;
|
|
14
24
|
minify: z.ZodOptional<z.ZodBoolean>;
|
|
15
25
|
title: z.ZodOptional<z.ZodString>;
|
|
16
26
|
favicon: z.ZodOptional<z.ZodString>;
|
|
17
27
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
28
|
+
hash: z.ZodOptional<z.ZodBoolean>;
|
|
18
29
|
}, "strict", z.ZodTypeAny, {
|
|
19
30
|
filename?: string | undefined;
|
|
20
31
|
publicPath?: string | undefined;
|
|
32
|
+
hash?: boolean | undefined;
|
|
21
33
|
chunks?: string[] | undefined;
|
|
22
34
|
template?: string | undefined;
|
|
23
35
|
templateContent?: string | undefined;
|
|
24
36
|
templateParameters?: Record<string, string> | undefined;
|
|
25
37
|
inject?: boolean | "head" | "body" | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
base?: string | {
|
|
39
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
40
|
+
href?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
43
|
+
excludeChunks?: string[] | undefined;
|
|
28
44
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
29
45
|
minify?: boolean | undefined;
|
|
30
46
|
title?: string | undefined;
|
|
@@ -33,13 +49,18 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
33
49
|
}, {
|
|
34
50
|
filename?: string | undefined;
|
|
35
51
|
publicPath?: string | undefined;
|
|
52
|
+
hash?: boolean | undefined;
|
|
36
53
|
chunks?: string[] | undefined;
|
|
37
54
|
template?: string | undefined;
|
|
38
55
|
templateContent?: string | undefined;
|
|
39
56
|
templateParameters?: Record<string, string> | undefined;
|
|
40
57
|
inject?: boolean | "head" | "body" | undefined;
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
base?: string | {
|
|
59
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
60
|
+
href?: string | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
63
|
+
excludeChunks?: string[] | undefined;
|
|
43
64
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
44
65
|
minify?: boolean | undefined;
|
|
45
66
|
title?: string | undefined;
|
|
@@ -51,13 +72,18 @@ export declare const HtmlRspackPlugin: {
|
|
|
51
72
|
new (c?: {
|
|
52
73
|
filename?: string | undefined;
|
|
53
74
|
publicPath?: string | undefined;
|
|
75
|
+
hash?: boolean | undefined;
|
|
54
76
|
chunks?: string[] | undefined;
|
|
55
77
|
template?: string | undefined;
|
|
56
78
|
templateContent?: string | undefined;
|
|
57
79
|
templateParameters?: Record<string, string> | undefined;
|
|
58
80
|
inject?: boolean | "head" | "body" | undefined;
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
base?: string | {
|
|
82
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
83
|
+
href?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
86
|
+
excludeChunks?: string[] | undefined;
|
|
61
87
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
62
88
|
minify?: boolean | undefined;
|
|
63
89
|
title?: string | undefined;
|
|
@@ -68,13 +94,18 @@ export declare const HtmlRspackPlugin: {
|
|
|
68
94
|
_args: [c?: {
|
|
69
95
|
filename?: string | undefined;
|
|
70
96
|
publicPath?: string | undefined;
|
|
97
|
+
hash?: boolean | undefined;
|
|
71
98
|
chunks?: string[] | undefined;
|
|
72
99
|
template?: string | undefined;
|
|
73
100
|
templateContent?: string | undefined;
|
|
74
101
|
templateParameters?: Record<string, string> | undefined;
|
|
75
102
|
inject?: boolean | "head" | "body" | undefined;
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
base?: string | {
|
|
104
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
105
|
+
href?: string | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
108
|
+
excludeChunks?: string[] | undefined;
|
|
78
109
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
79
110
|
minify?: boolean | undefined;
|
|
80
111
|
title?: string | undefined;
|
|
@@ -12,14 +12,24 @@ const htmlRspackPluginOptions = zod_1.z.strictObject({
|
|
|
12
12
|
templateParameters: zod_1.z.record(zod_1.z.string()).optional(),
|
|
13
13
|
inject: zod_1.z.enum(["head", "body"]).or(zod_1.z.boolean()).optional(),
|
|
14
14
|
publicPath: zod_1.z.string().optional(),
|
|
15
|
-
|
|
15
|
+
base: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.or(zod_1.z.strictObject({
|
|
18
|
+
href: zod_1.z.string().optional(),
|
|
19
|
+
target: zod_1.z.enum(["_self", "_blank", "_parent", "_top"]).optional()
|
|
20
|
+
}))
|
|
21
|
+
.optional(),
|
|
22
|
+
scriptLoading: zod_1.z
|
|
23
|
+
.enum(["blocking", "defer", "module", "systemjs-module"])
|
|
24
|
+
.optional(),
|
|
16
25
|
chunks: zod_1.z.string().array().optional(),
|
|
17
|
-
|
|
26
|
+
excludeChunks: zod_1.z.string().array().optional(),
|
|
18
27
|
sri: zod_1.z.enum(["sha256", "sha384", "sha512"]).optional(),
|
|
19
28
|
minify: zod_1.z.boolean().optional(),
|
|
20
29
|
title: zod_1.z.string().optional(),
|
|
21
30
|
favicon: zod_1.z.string().optional(),
|
|
22
|
-
meta: zod_1.z.record(zod_1.z.string().or(zod_1.z.record(zod_1.z.string()))).optional()
|
|
31
|
+
meta: zod_1.z.record(zod_1.z.string().or(zod_1.z.record(zod_1.z.string()))).optional(),
|
|
32
|
+
hash: zod_1.z.boolean().optional()
|
|
23
33
|
});
|
|
24
34
|
exports.HtmlRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.HtmlRspackPlugin, (c = {}) => {
|
|
25
35
|
(0, validate_1.validate)(c, htmlRspackPluginOptions);
|
|
@@ -48,10 +58,12 @@ exports.HtmlRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.HtmlRs
|
|
|
48
58
|
: configInject === false
|
|
49
59
|
? "false"
|
|
50
60
|
: configInject;
|
|
61
|
+
const base = typeof c.base === "string" ? { href: c.base } : c.base;
|
|
51
62
|
return {
|
|
52
63
|
...c,
|
|
53
64
|
meta,
|
|
54
65
|
scriptLoading,
|
|
55
|
-
inject
|
|
66
|
+
inject,
|
|
67
|
+
base
|
|
56
68
|
};
|
|
57
69
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { type Drafts, type FeatureOptions, type NonStandard, type PseudoClasses
|
|
2
|
+
import { type Drafts, type FeatureOptions, type NonStandard, type PseudoClasses } from "../builtin-loader/lightningcss";
|
|
3
3
|
import type { AssetConditions } from "../util/assetCondition";
|
|
4
4
|
export type LightningCssMinimizerRspackPluginOptions = {
|
|
5
5
|
test?: AssetConditions;
|
|
@@ -8,7 +8,7 @@ export type LightningCssMinimizerRspackPluginOptions = {
|
|
|
8
8
|
removeUnusedLocalIdents?: boolean;
|
|
9
9
|
minimizerOptions?: {
|
|
10
10
|
errorRecovery?: boolean;
|
|
11
|
-
targets?:
|
|
11
|
+
targets?: string[] | string;
|
|
12
12
|
include?: FeatureOptions;
|
|
13
13
|
exclude?: FeatureOptions;
|
|
14
14
|
draft?: Drafts;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.LightningCssMinimizerRspackPlugin = void 0;
|
|
7
4
|
const binding_1 = require("@rspack/binding");
|
|
8
|
-
const browserslist_1 = __importDefault(require("../../compiled/browserslist"));
|
|
9
5
|
const lightningcss_1 = require("../builtin-loader/lightningcss");
|
|
10
6
|
const base_1 = require("./base");
|
|
11
7
|
exports.LightningCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.LightningCssMinimizerRspackPlugin, (options) => {
|
|
@@ -25,9 +21,7 @@ exports.LightningCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.Builtin
|
|
|
25
21
|
: // exclude all features, avoid downgrade css syntax when minimize
|
|
26
22
|
// 1048575 = Features.Empty | Features.Nesting | ... | Features.LogicalProperties
|
|
27
23
|
1048575,
|
|
28
|
-
targets: typeof targets === "string"
|
|
29
|
-
? (0, lightningcss_1.browserslistToTargets)((0, browserslist_1.default)(targets))
|
|
30
|
-
: targets,
|
|
24
|
+
targets: typeof targets === "string" ? [targets] : targets,
|
|
31
25
|
draft: draft ? { customMedia: draft.customMedia ?? false } : undefined,
|
|
32
26
|
nonStandard: nonStandard
|
|
33
27
|
? {
|
|
@@ -8,7 +8,7 @@ export interface CssExtractRspackLoaderOptions {
|
|
|
8
8
|
publicPath?: string | ((resourcePath: string, context: string) => string);
|
|
9
9
|
emit?: boolean;
|
|
10
10
|
esModule?: boolean;
|
|
11
|
-
layer?:
|
|
11
|
+
layer?: string;
|
|
12
12
|
defaultExport?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare function hotLoader(content: string, context: {
|
|
@@ -190,22 +190,14 @@ const pitch = function (request, _, data) {
|
|
|
190
190
|
if (dependencies.length > 0) {
|
|
191
191
|
additionalData[index_1.CssExtractRspackPlugin.pluginName] = dependencies
|
|
192
192
|
.map(dep => {
|
|
193
|
-
return
|
|
194
|
-
dep.identifier,
|
|
195
|
-
dep.content,
|
|
196
|
-
dep.context,
|
|
197
|
-
dep.media,
|
|
198
|
-
dep.supports,
|
|
199
|
-
dep.sourceMap,
|
|
200
|
-
dep.identifierIndex,
|
|
201
|
-
dep.filepath
|
|
202
|
-
].join(SERIALIZE_SEP);
|
|
193
|
+
return JSON.stringify(dep);
|
|
203
194
|
})
|
|
204
195
|
.join(SERIALIZE_SEP);
|
|
205
196
|
}
|
|
206
197
|
callback(null, resultSource, undefined, additionalData);
|
|
207
198
|
};
|
|
208
199
|
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
|
|
200
|
+
layer: options.layer,
|
|
209
201
|
publicPath: /** @type {Filename} */ publicPathForExtract,
|
|
210
202
|
baseUri: `${exports.BASE_URI}/`
|
|
211
203
|
}, (error, exports) => {
|
|
@@ -56,7 +56,6 @@ export * from "./SideEffectsFlagPlugin";
|
|
|
56
56
|
export * from "./SizeLimitsPlugin";
|
|
57
57
|
export * from "./SourceMapDevToolPlugin";
|
|
58
58
|
export * from "./SplitChunksPlugin";
|
|
59
|
-
export * from "./SwcCssMinimizerPlugin";
|
|
60
59
|
export * from "./LightningCssMiminizerRspackPlugin";
|
|
61
60
|
export * from "./SwcJsMinimizerPlugin";
|
|
62
61
|
export * from "./WarnCaseSensitiveModulesPlugin";
|
|
@@ -74,7 +74,6 @@ __exportStar(require("./SideEffectsFlagPlugin"), exports);
|
|
|
74
74
|
__exportStar(require("./SizeLimitsPlugin"), exports);
|
|
75
75
|
__exportStar(require("./SourceMapDevToolPlugin"), exports);
|
|
76
76
|
__exportStar(require("./SplitChunksPlugin"), exports);
|
|
77
|
-
__exportStar(require("./SwcCssMinimizerPlugin"), exports);
|
|
78
77
|
__exportStar(require("./LightningCssMiminizerRspackPlugin"), exports);
|
|
79
78
|
__exportStar(require("./SwcJsMinimizerPlugin"), exports);
|
|
80
79
|
__exportStar(require("./WarnCaseSensitiveModulesPlugin"), exports);
|
|
@@ -87,6 +87,7 @@ export interface LoaderContext<OptionsType = {}> {
|
|
|
87
87
|
getMissingDependencies(): string[];
|
|
88
88
|
addBuildDependency(file: string): void;
|
|
89
89
|
importModule(request: string, options: {
|
|
90
|
+
layer?: string;
|
|
90
91
|
publicPath?: PublicPath;
|
|
91
92
|
baseUri?: string;
|
|
92
93
|
}, callback: (err?: Error, res?: any) => void): void;
|
|
@@ -5,7 +5,6 @@ const builtin_loader_1 = require("../builtin-loader");
|
|
|
5
5
|
const lightningcss_1 = require("../builtin-loader/lightningcss");
|
|
6
6
|
const loader_runner_1 = require("../loader-runner");
|
|
7
7
|
const util_1 = require("../util");
|
|
8
|
-
const browserslist = require("../../compiled/browserslist");
|
|
9
8
|
exports.BUILTIN_LOADER_PREFIX = "builtin:";
|
|
10
9
|
function createRawModuleRuleUses(uses, path, options) {
|
|
11
10
|
const normalizeRuleSetUseItem = (item) => typeof item === "string" ? { loader: item } : item;
|
|
@@ -26,11 +25,8 @@ const getSwcLoaderOptions = (o, _) => {
|
|
|
26
25
|
};
|
|
27
26
|
const getLightningcssLoaderOptions = (o, _) => {
|
|
28
27
|
if (o && typeof o === "object") {
|
|
29
|
-
if (
|
|
30
|
-
o.targets =
|
|
31
|
-
}
|
|
32
|
-
if (o.targets && Array.isArray(o.targets)) {
|
|
33
|
-
o.targets = (0, lightningcss_1.browserslistToTargets)(browserslist(o.targets));
|
|
28
|
+
if (typeof o.targets === "string") {
|
|
29
|
+
o.targets = [o.targets];
|
|
34
30
|
}
|
|
35
31
|
if (o.include && typeof o.include === "object") {
|
|
36
32
|
o.include = (0, lightningcss_1.toFeatures)(o.include);
|
package/dist/config/defaults.js
CHANGED
|
@@ -69,6 +69,8 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
69
69
|
entry: options.entry,
|
|
70
70
|
futureDefaults: options.experiments.futureDefaults
|
|
71
71
|
});
|
|
72
|
+
// bundlerInfo is affected by outputDefaults so must be executed after outputDefaults
|
|
73
|
+
applybundlerInfoDefaults(options.experiments.rspackFuture, options.output.library);
|
|
72
74
|
applyExternalsPresetsDefaults(options.externalsPresets, {
|
|
73
75
|
targetProperties
|
|
74
76
|
});
|
|
@@ -133,12 +135,16 @@ const applyExperimentsDefaults = (experiments) => {
|
|
|
133
135
|
D(experiments, "topLevelAwait", true);
|
|
134
136
|
// IGNORE(experiments.rspackFuture): Rspack specific configuration
|
|
135
137
|
D(experiments, "rspackFuture", {});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
// rspackFuture.bundlerInfo default value is applied after applyDefaults
|
|
139
|
+
};
|
|
140
|
+
const applybundlerInfoDefaults = (rspackFuture, library) => {
|
|
141
|
+
if (typeof rspackFuture === "object") {
|
|
142
|
+
D(rspackFuture, "bundlerInfo", {});
|
|
143
|
+
if (typeof rspackFuture.bundlerInfo === "object") {
|
|
144
|
+
D(rspackFuture.bundlerInfo, "version", require("../../package.json").version);
|
|
145
|
+
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
146
|
+
// don't inject for library mode
|
|
147
|
+
D(rspackFuture.bundlerInfo, "force", !library);
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
};
|
|
@@ -692,7 +698,7 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
692
698
|
D(optimization, "realContentHash", production);
|
|
693
699
|
D(optimization, "minimize", production);
|
|
694
700
|
D(optimization, "concatenateModules", production);
|
|
695
|
-
// IGNORE(optimization.minimizer): Rspack use `SwcJsMinimizerRspackPlugin` and `
|
|
701
|
+
// IGNORE(optimization.minimizer): Rspack use `SwcJsMinimizerRspackPlugin` and `LightningCssMinimizerRspackPlugin` by default
|
|
696
702
|
A(optimization, "minimizer", () => [
|
|
697
703
|
new builtin_plugin_1.SwcJsMinimizerRspackPlugin(),
|
|
698
704
|
new builtin_plugin_1.LightningCssMinimizerRspackPlugin()
|
package/dist/exports.d.ts
CHANGED
|
@@ -140,7 +140,6 @@ export type { EvalDevToolModulePluginOptions } from "./builtin-plugin";
|
|
|
140
140
|
export type { CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions } from "./builtin-plugin";
|
|
141
141
|
export { HtmlRspackPlugin } from "./builtin-plugin";
|
|
142
142
|
export { SwcJsMinimizerRspackPlugin } from "./builtin-plugin";
|
|
143
|
-
export { SwcCssMinimizerRspackPlugin } from "./builtin-plugin";
|
|
144
143
|
export { LightningCssMinimizerRspackPlugin } from "./builtin-plugin";
|
|
145
144
|
export { CopyRspackPlugin } from "./builtin-plugin";
|
|
146
145
|
export { SourceMapDevToolPlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.
|
|
30
|
-
exports.experiments = void 0;
|
|
29
|
+
exports.experiments = exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
|
|
31
30
|
const package_json_1 = require("../package.json");
|
|
32
31
|
// this is a hack to be compatible with plugin which detect webpack's version
|
|
33
32
|
const rspackVersion = package_json_1.version;
|
|
@@ -154,19 +153,17 @@ Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: func
|
|
|
154
153
|
var builtin_plugin_21 = require("./builtin-plugin");
|
|
155
154
|
Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_21.SwcJsMinimizerRspackPlugin; } });
|
|
156
155
|
var builtin_plugin_22 = require("./builtin-plugin");
|
|
157
|
-
Object.defineProperty(exports, "
|
|
156
|
+
Object.defineProperty(exports, "LightningCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.LightningCssMinimizerRspackPlugin; } });
|
|
158
157
|
var builtin_plugin_23 = require("./builtin-plugin");
|
|
159
|
-
Object.defineProperty(exports, "
|
|
158
|
+
Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.CopyRspackPlugin; } });
|
|
160
159
|
var builtin_plugin_24 = require("./builtin-plugin");
|
|
161
|
-
Object.defineProperty(exports, "
|
|
160
|
+
Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_24.SourceMapDevToolPlugin; } });
|
|
162
161
|
var builtin_plugin_25 = require("./builtin-plugin");
|
|
163
|
-
Object.defineProperty(exports, "
|
|
162
|
+
Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_25.EvalSourceMapDevToolPlugin; } });
|
|
164
163
|
var builtin_plugin_26 = require("./builtin-plugin");
|
|
165
|
-
Object.defineProperty(exports, "
|
|
164
|
+
Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_26.EvalDevToolModulePlugin; } });
|
|
166
165
|
var builtin_plugin_27 = require("./builtin-plugin");
|
|
167
|
-
Object.defineProperty(exports, "
|
|
168
|
-
var builtin_plugin_28 = require("./builtin-plugin");
|
|
169
|
-
Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_28.CssExtractRspackPlugin; } });
|
|
166
|
+
Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_27.CssExtractRspackPlugin; } });
|
|
170
167
|
///// Experiments Stuff /////
|
|
171
168
|
const binding_1 = require("@rspack/binding");
|
|
172
169
|
exports.experiments = {
|
|
@@ -335,7 +335,7 @@ async function runLoaders(compiler, context) {
|
|
|
335
335
|
return new Promise((resolve, reject) => {
|
|
336
336
|
compiler
|
|
337
337
|
._lastCompilation.__internal_getInner()
|
|
338
|
-
.importModule(request, options.publicPath, options.baseUri, context._module.moduleIdentifier, loaderContext.context, (err, res) => {
|
|
338
|
+
.importModule(request, options.layer, options.publicPath, options.baseUri, context._module.moduleIdentifier, loaderContext.context, (err, res) => {
|
|
339
339
|
if (err)
|
|
340
340
|
reject(err);
|
|
341
341
|
else {
|
|
@@ -361,7 +361,7 @@ async function runLoaders(compiler, context) {
|
|
|
361
361
|
}
|
|
362
362
|
return compiler
|
|
363
363
|
._lastCompilation.__internal_getInner()
|
|
364
|
-
.importModule(request, options.publicPath, options.baseUri, context._module.moduleIdentifier, loaderContext.context, (err, res) => {
|
|
364
|
+
.importModule(request, options.layer, options.publicPath, options.baseUri, context._module.moduleIdentifier, loaderContext.context, (err, res) => {
|
|
365
365
|
if (err) {
|
|
366
366
|
callback(err, undefined);
|
|
367
367
|
}
|
|
@@ -613,7 +613,7 @@ async function runLoaders(compiler, context) {
|
|
|
613
613
|
let compilation = compiler._lastCompilation;
|
|
614
614
|
let step = 0;
|
|
615
615
|
while (compilation) {
|
|
616
|
-
NormalModule_1.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext);
|
|
616
|
+
NormalModule_1.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module);
|
|
617
617
|
compilation = compilation.compiler.parentCompilation;
|
|
618
618
|
step++;
|
|
619
619
|
if (step > 1000) {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import Watchpack from "../../compiled/watchpack";
|
|
11
|
-
import type { FileSystemInfoEntry, WatchFileSystem, Watcher } from "../util/fs";
|
|
11
|
+
import type { FileSystemInfoEntry, InputFileSystem, WatchFileSystem, Watcher } from "../util/fs";
|
|
12
12
|
export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
13
|
-
inputFileSystem:
|
|
13
|
+
inputFileSystem: InputFileSystem;
|
|
14
14
|
watcherOptions: Watchpack.WatchOptions;
|
|
15
15
|
watcher: Watchpack;
|
|
16
|
-
constructor(inputFileSystem:
|
|
16
|
+
constructor(inputFileSystem: InputFileSystem);
|
|
17
17
|
watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
18
18
|
}
|
|
@@ -63,10 +63,10 @@ class NodeWatchFileSystem {
|
|
|
63
63
|
if (this.inputFileSystem?.purge) {
|
|
64
64
|
const fs = this.inputFileSystem;
|
|
65
65
|
for (const item of changes) {
|
|
66
|
-
fs.purge(item);
|
|
66
|
+
fs.purge?.(item);
|
|
67
67
|
}
|
|
68
68
|
for (const item of removals) {
|
|
69
|
-
fs.purge(item);
|
|
69
|
+
fs.purge?.(item);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
const { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
|
|
@@ -96,7 +96,7 @@ class NodeWatchFileSystem {
|
|
|
96
96
|
if (items && this.inputFileSystem && this.inputFileSystem.purge) {
|
|
97
97
|
const fs = this.inputFileSystem;
|
|
98
98
|
for (const item of items) {
|
|
99
|
-
fs.purge(item);
|
|
99
|
+
fs.purge?.(item);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return items;
|
|
@@ -106,7 +106,7 @@ class NodeWatchFileSystem {
|
|
|
106
106
|
if (items && this.inputFileSystem && this.inputFileSystem.purge) {
|
|
107
107
|
const fs = this.inputFileSystem;
|
|
108
108
|
for (const item of items) {
|
|
109
|
-
fs.purge(item);
|
|
109
|
+
fs.purge?.(item);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
return items;
|
|
@@ -124,12 +124,12 @@ class NodeWatchFileSystem {
|
|
|
124
124
|
const fs = this.inputFileSystem;
|
|
125
125
|
if (removals) {
|
|
126
126
|
for (const item of removals) {
|
|
127
|
-
fs.purge(item);
|
|
127
|
+
fs.purge?.(item);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
if (changes) {
|
|
131
131
|
for (const item of changes) {
|
|
132
|
-
fs.purge(item);
|
|
132
|
+
fs.purge?.(item);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/// <reference types="node" />
|
|
11
11
|
/// <reference types="node" />
|
|
12
|
+
/// <reference types="node" />
|
|
13
|
+
import type { Abortable } from "node:events";
|
|
12
14
|
import type { WatchOptions } from "../config";
|
|
13
15
|
export interface Watcher {
|
|
14
16
|
close(): void;
|
|
@@ -25,7 +27,7 @@ export interface WatcherInfo {
|
|
|
25
27
|
fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">;
|
|
26
28
|
contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">;
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
export type IStatsBase<T> = {
|
|
29
31
|
isFile: () => boolean;
|
|
30
32
|
isDirectory: () => boolean;
|
|
31
33
|
isBlockDevice: () => boolean;
|
|
@@ -33,9 +35,33 @@ interface IDirent {
|
|
|
33
35
|
isSymbolicLink: () => boolean;
|
|
34
36
|
isFIFO: () => boolean;
|
|
35
37
|
isSocket: () => boolean;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
dev: T;
|
|
39
|
+
ino: T;
|
|
40
|
+
mode: T;
|
|
41
|
+
nlink: T;
|
|
42
|
+
uid: T;
|
|
43
|
+
gid: T;
|
|
44
|
+
rdev: T;
|
|
45
|
+
size: T;
|
|
46
|
+
blksize: T;
|
|
47
|
+
blocks: T;
|
|
48
|
+
atimeMs: T;
|
|
49
|
+
mtimeMs: T;
|
|
50
|
+
ctimeMs: T;
|
|
51
|
+
birthtimeMs: T;
|
|
52
|
+
atime: Date;
|
|
53
|
+
mtime: Date;
|
|
54
|
+
ctime: Date;
|
|
55
|
+
birthtime: Date;
|
|
56
|
+
};
|
|
57
|
+
export type IStats = IStatsBase<number>;
|
|
58
|
+
export type IBigIntStats = IStatsBase<bigint> & {
|
|
59
|
+
atimeNs: bigint;
|
|
60
|
+
mtimeNs: bigint;
|
|
61
|
+
ctimeNs: bigint;
|
|
62
|
+
birthtimeNs: bigint;
|
|
63
|
+
};
|
|
64
|
+
interface IDirent {
|
|
39
65
|
isFile: () => boolean;
|
|
40
66
|
isDirectory: () => boolean;
|
|
41
67
|
isBlockDevice: () => boolean;
|
|
@@ -43,24 +69,7 @@ interface IStats {
|
|
|
43
69
|
isSymbolicLink: () => boolean;
|
|
44
70
|
isFIFO: () => boolean;
|
|
45
71
|
isSocket: () => boolean;
|
|
46
|
-
|
|
47
|
-
ino: number | bigint;
|
|
48
|
-
mode: number | bigint;
|
|
49
|
-
nlink: number | bigint;
|
|
50
|
-
uid: number | bigint;
|
|
51
|
-
gid: number | bigint;
|
|
52
|
-
rdev: number | bigint;
|
|
53
|
-
size: number | bigint;
|
|
54
|
-
blksize: number | bigint;
|
|
55
|
-
blocks: number | bigint;
|
|
56
|
-
atimeMs: number | bigint;
|
|
57
|
-
mtimeMs: number | bigint;
|
|
58
|
-
ctimeMs: number | bigint;
|
|
59
|
-
birthtimeMs: number | bigint;
|
|
60
|
-
atime: Date;
|
|
61
|
-
mtime: Date;
|
|
62
|
-
ctime: Date;
|
|
63
|
-
birthtime: Date;
|
|
72
|
+
name: string | Buffer;
|
|
64
73
|
}
|
|
65
74
|
export interface OutputFileSystem {
|
|
66
75
|
writeFile: (arg0: string, arg1: string | Buffer, arg2: (arg0?: null | NodeJS.ErrnoException) => void) => void;
|
|
@@ -75,6 +84,220 @@ export interface OutputFileSystem {
|
|
|
75
84
|
relative?: (arg0: string, arg1: string) => string;
|
|
76
85
|
dirname?: (arg0: string) => string;
|
|
77
86
|
}
|
|
87
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
88
|
+
export type JsonArray = JsonValue[];
|
|
89
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
90
|
+
export type JsonObject = {
|
|
91
|
+
[Key in string]: JsonValue;
|
|
92
|
+
} & {
|
|
93
|
+
[Key in string]?: JsonValue | undefined;
|
|
94
|
+
};
|
|
95
|
+
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
96
|
+
export type StringCallback = (err: NodeJS.ErrnoException | null, data?: string) => void;
|
|
97
|
+
export type BufferCallback = (err: NodeJS.ErrnoException | null, data?: Buffer) => void;
|
|
98
|
+
export type StringOrBufferCallback = (err: NodeJS.ErrnoException | null, data?: string | Buffer) => void;
|
|
99
|
+
export type ReaddirStringCallback = (err: NodeJS.ErrnoException | null, files?: string[]) => void;
|
|
100
|
+
export type ReaddirBufferCallback = (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void;
|
|
101
|
+
export type ReaddirStringOrBufferCallback = (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void;
|
|
102
|
+
export type ReaddirDirentCallback = (err: NodeJS.ErrnoException | null, files?: IDirent[]) => void;
|
|
103
|
+
export type StatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats) => void;
|
|
104
|
+
export type BigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IBigIntStats) => void;
|
|
105
|
+
export type StatsOrBigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats | IBigIntStats) => void;
|
|
106
|
+
export type NumberCallback = (err: NodeJS.ErrnoException | null, data?: number) => void;
|
|
107
|
+
export type ReadJsonCallback = (err: NodeJS.ErrnoException | Error | null, data?: JsonObject) => void;
|
|
108
|
+
export type PathLike = string | Buffer | URL;
|
|
109
|
+
export type PathOrFileDescriptor = PathLike | number;
|
|
110
|
+
export type ObjectEncodingOptions = {
|
|
111
|
+
encoding?: BufferEncoding | null;
|
|
112
|
+
};
|
|
113
|
+
export type ReadFile = {
|
|
114
|
+
(path: PathOrFileDescriptor, options: ({
|
|
115
|
+
encoding: null | undefined;
|
|
116
|
+
flag?: string;
|
|
117
|
+
} & Abortable) | null | undefined, callback: BufferCallback): void;
|
|
118
|
+
(path: PathOrFileDescriptor, options: ({
|
|
119
|
+
encoding: BufferEncoding;
|
|
120
|
+
flag?: string;
|
|
121
|
+
} & Abortable) | BufferEncoding, callback: StringCallback): void;
|
|
122
|
+
(path: PathOrFileDescriptor, options: (ObjectEncodingOptions & {
|
|
123
|
+
flag?: string;
|
|
124
|
+
} & Abortable) | BufferEncoding | null | undefined, callback: StringOrBufferCallback): void;
|
|
125
|
+
(path: PathOrFileDescriptor, callback: BufferCallback): void;
|
|
126
|
+
};
|
|
127
|
+
export type ReadFileSync = {
|
|
128
|
+
(path: PathOrFileDescriptor, options: {
|
|
129
|
+
encoding: null | undefined;
|
|
130
|
+
flag?: string;
|
|
131
|
+
} | null): Buffer;
|
|
132
|
+
(path: PathOrFileDescriptor, options: {
|
|
133
|
+
encoding: BufferEncoding;
|
|
134
|
+
flag?: string;
|
|
135
|
+
} | BufferEncoding): string;
|
|
136
|
+
(path: PathOrFileDescriptor, options: (ObjectEncodingOptions & {
|
|
137
|
+
flag?: string;
|
|
138
|
+
}) | BufferEncoding | null): string | Buffer;
|
|
139
|
+
};
|
|
140
|
+
export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
|
|
141
|
+
export type BufferEncodingOption = "buffer" | {
|
|
142
|
+
encoding: "buffer";
|
|
143
|
+
};
|
|
144
|
+
export type StatOptions = {
|
|
145
|
+
bigint?: boolean;
|
|
146
|
+
};
|
|
147
|
+
export type StatSyncOptions = {
|
|
148
|
+
bigint?: boolean;
|
|
149
|
+
throwIfNoEntry?: boolean;
|
|
150
|
+
};
|
|
151
|
+
export type Readlink = {
|
|
152
|
+
(path: PathLike, options: EncodingOption, callback: StringCallback): void;
|
|
153
|
+
(path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
|
|
154
|
+
(path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
|
|
155
|
+
(path: PathLike, callback: StringCallback): void;
|
|
156
|
+
};
|
|
157
|
+
export type ReadlinkSync = {
|
|
158
|
+
(path: PathLike, options: EncodingOption): string;
|
|
159
|
+
(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
160
|
+
(path: PathLike, options: EncodingOption): string | Buffer;
|
|
161
|
+
};
|
|
162
|
+
export type Readdir = {
|
|
163
|
+
(path: PathLike, options: {
|
|
164
|
+
encoding: BufferEncoding | null;
|
|
165
|
+
withFileTypes?: false;
|
|
166
|
+
recursive?: boolean;
|
|
167
|
+
} | BufferEncoding | null | undefined, callback: ReaddirStringCallback): void;
|
|
168
|
+
(path: PathLike, options: {
|
|
169
|
+
encoding: "buffer";
|
|
170
|
+
withFileTypes?: false;
|
|
171
|
+
recursive?: boolean;
|
|
172
|
+
} | "buffer", callback: ReaddirBufferCallback): void;
|
|
173
|
+
(path: PathLike, callback: ReaddirStringCallback): void;
|
|
174
|
+
(path: PathLike, options: (ObjectEncodingOptions & {
|
|
175
|
+
withFileTypes: true;
|
|
176
|
+
recursive?: boolean;
|
|
177
|
+
}) | BufferEncoding | null | undefined, callback: ReaddirStringOrBufferCallback): void;
|
|
178
|
+
(path: PathLike, options: ObjectEncodingOptions & {
|
|
179
|
+
withFileTypes: true;
|
|
180
|
+
recursive?: boolean;
|
|
181
|
+
}, callback: ReaddirDirentCallback): void;
|
|
182
|
+
};
|
|
183
|
+
export type ReaddirSync = {
|
|
184
|
+
(path: PathLike, options: {
|
|
185
|
+
encoding: BufferEncoding | null;
|
|
186
|
+
withFileTypes?: false;
|
|
187
|
+
recursive?: boolean;
|
|
188
|
+
} | BufferEncoding | null): string[];
|
|
189
|
+
(path: PathLike, options: {
|
|
190
|
+
encoding: "buffer";
|
|
191
|
+
withFileTypes?: false;
|
|
192
|
+
recursive?: boolean;
|
|
193
|
+
} | "buffer"): Buffer[];
|
|
194
|
+
(path: PathLike, options: (ObjectEncodingOptions & {
|
|
195
|
+
withFileTypes?: false;
|
|
196
|
+
recursive?: boolean;
|
|
197
|
+
}) | BufferEncoding | null): string[] | Buffer[];
|
|
198
|
+
(path: PathLike, options: ObjectEncodingOptions & {
|
|
199
|
+
withFileTypes: true;
|
|
200
|
+
recursive?: boolean;
|
|
201
|
+
}): IDirent[];
|
|
202
|
+
};
|
|
203
|
+
export type Stat = {
|
|
204
|
+
(path: PathLike, callback: StatsCallback): void;
|
|
205
|
+
(path: PathLike, options: (StatOptions & {
|
|
206
|
+
bigint?: false;
|
|
207
|
+
}) | undefined, callback: StatsCallback): void;
|
|
208
|
+
(path: PathLike, options: StatOptions & {
|
|
209
|
+
bigint: true;
|
|
210
|
+
}, callback: BigIntStatsCallback): void;
|
|
211
|
+
(path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
|
|
212
|
+
};
|
|
213
|
+
export type StatSync = {
|
|
214
|
+
(path: PathLike, options?: undefined): IStats;
|
|
215
|
+
(path: PathLike, options?: StatSyncOptions & {
|
|
216
|
+
bigint?: false;
|
|
217
|
+
throwIfNoEntry: false;
|
|
218
|
+
}): IStats | undefined;
|
|
219
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
220
|
+
bigint: true;
|
|
221
|
+
throwIfNoEntry: false;
|
|
222
|
+
}): IBigIntStats | undefined;
|
|
223
|
+
(path: PathLike, options?: StatSyncOptions & {
|
|
224
|
+
bigint?: false;
|
|
225
|
+
}): IStats;
|
|
226
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
227
|
+
bigint: true;
|
|
228
|
+
}): IBigIntStats;
|
|
229
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
230
|
+
bigint: boolean;
|
|
231
|
+
throwIfNoEntry?: false;
|
|
232
|
+
}): IStats | IBigIntStats;
|
|
233
|
+
(path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
|
|
234
|
+
};
|
|
235
|
+
export type LStat = {
|
|
236
|
+
(path: PathLike, callback: StatsCallback): void;
|
|
237
|
+
(path: PathLike, options: (StatOptions & {
|
|
238
|
+
bigint?: false;
|
|
239
|
+
}) | undefined, callback: StatsCallback): void;
|
|
240
|
+
(path: PathLike, options: StatOptions & {
|
|
241
|
+
bigint: true;
|
|
242
|
+
}, callback: BigIntStatsCallback): void;
|
|
243
|
+
(path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
|
|
244
|
+
};
|
|
245
|
+
export type LStatSync = {
|
|
246
|
+
(path: PathLike, options?: undefined): IStats;
|
|
247
|
+
(path: PathLike, options?: StatSyncOptions & {
|
|
248
|
+
bigint?: false;
|
|
249
|
+
throwIfNoEntry: false;
|
|
250
|
+
}): IStats | undefined;
|
|
251
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
252
|
+
bigint: true;
|
|
253
|
+
throwIfNoEntry: false;
|
|
254
|
+
}): IBigIntStats | undefined;
|
|
255
|
+
(path: PathLike, options?: StatSyncOptions & {
|
|
256
|
+
bigint?: false;
|
|
257
|
+
}): IStats;
|
|
258
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
259
|
+
bigint: true;
|
|
260
|
+
}): IBigIntStats;
|
|
261
|
+
(path: PathLike, options: StatSyncOptions & {
|
|
262
|
+
bigint: boolean;
|
|
263
|
+
throwIfNoEntry?: false;
|
|
264
|
+
}): IStats | IBigIntStats;
|
|
265
|
+
(path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
|
|
266
|
+
};
|
|
267
|
+
export type RealPath = {
|
|
268
|
+
(path: PathLike, options: EncodingOption, callback: StringCallback): void;
|
|
269
|
+
(path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
|
|
270
|
+
(path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
|
|
271
|
+
(path: PathLike, callback: StringCallback): void;
|
|
272
|
+
};
|
|
273
|
+
export type RealPathSync = {
|
|
274
|
+
(path: PathLike, options?: EncodingOption): string;
|
|
275
|
+
(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
276
|
+
(path: PathLike, options?: EncodingOption): string | Buffer;
|
|
277
|
+
};
|
|
278
|
+
export type ReadJson = (path: PathOrFileDescriptor, callback: ReadJsonCallback) => void;
|
|
279
|
+
export type ReadJsonSync = (path: PathOrFileDescriptor) => JsonObject;
|
|
280
|
+
export type Purge = (files?: string | string[] | Set<string>) => void;
|
|
281
|
+
export type InputFileSystem = {
|
|
282
|
+
readFile: ReadFile;
|
|
283
|
+
readFileSync?: ReadFileSync;
|
|
284
|
+
readlink: Readlink;
|
|
285
|
+
readlinkSync?: ReadlinkSync;
|
|
286
|
+
readdir: Readdir;
|
|
287
|
+
readdirSync?: ReaddirSync;
|
|
288
|
+
stat: Stat;
|
|
289
|
+
statSync?: StatSync;
|
|
290
|
+
lstat?: LStat;
|
|
291
|
+
lstatSync?: LStatSync;
|
|
292
|
+
realpath?: RealPath;
|
|
293
|
+
realpathSync?: RealPathSync;
|
|
294
|
+
readJson?: ReadJson;
|
|
295
|
+
readJsonSync?: ReadJsonSync;
|
|
296
|
+
purge?: Purge;
|
|
297
|
+
join?: (path1: string, path2: string) => string;
|
|
298
|
+
relative?: (from: string, to: string) => string;
|
|
299
|
+
dirname?: (path: string) => string;
|
|
300
|
+
};
|
|
78
301
|
export declare function rmrf(fs: OutputFileSystem, p: string, callback: (err?: Error | null) => void): void;
|
|
79
302
|
export declare const mkdirp: (fs: OutputFileSystem, p: string, callback: (error?: Error) => void) => void;
|
|
80
303
|
export interface FileSystemInfoEntry {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@module-federation/runtime-tools": "0.2.3",
|
|
61
|
-
"@rspack/lite-tapable": "1.0.0
|
|
61
|
+
"@rspack/lite-tapable": "1.0.0",
|
|
62
62
|
"caniuse-lite": "^1.0.30001616",
|
|
63
|
-
"@rspack/binding": "1.0.0-beta.
|
|
63
|
+
"@rspack/binding": "1.0.0-beta.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@swc/helpers": ">=0.5.1"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import type { AssetConditions } from "../util/assetCondition";
|
|
3
|
-
export type SwcCssMinimizerRspackPluginOptions = {
|
|
4
|
-
test?: AssetConditions;
|
|
5
|
-
exclude?: AssetConditions;
|
|
6
|
-
include?: AssetConditions;
|
|
7
|
-
};
|
|
8
|
-
export declare const SwcCssMinimizerRspackPlugin: {
|
|
9
|
-
new (options?: SwcCssMinimizerRspackPluginOptions | undefined): {
|
|
10
|
-
name: BuiltinPluginName;
|
|
11
|
-
_args: [options?: SwcCssMinimizerRspackPluginOptions | undefined];
|
|
12
|
-
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
13
|
-
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
14
|
-
apply(compiler: import("../Compiler").Compiler): void;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwcCssMinimizerRspackPlugin = void 0;
|
|
4
|
-
const binding_1 = require("@rspack/binding");
|
|
5
|
-
const base_1 = require("./base");
|
|
6
|
-
exports.SwcCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcCssMinimizerRspackPlugin, (options) => {
|
|
7
|
-
return {
|
|
8
|
-
test: options?.test,
|
|
9
|
-
include: options?.include,
|
|
10
|
-
exclude: options?.exclude
|
|
11
|
-
};
|
|
12
|
-
});
|