@rspack/core 0.0.0-02df4322c5-20221125030212
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/README.md +1 -0
- package/dist/chunk_group.d.ts +7 -0
- package/dist/chunk_group.d.ts.map +1 -0
- package/dist/chunk_group.js +33 -0
- package/dist/chunk_group.js.map +1 -0
- package/dist/compilation.d.ts +80 -0
- package/dist/compilation.d.ts.map +1 -0
- package/dist/compilation.js +175 -0
- package/dist/compilation.js.map +1 -0
- package/dist/compiler.d.ts +51 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +362 -0
- package/dist/compiler.js.map +1 -0
- package/dist/config/RspackOptions.d.ts +36 -0
- package/dist/config/RspackOptions.d.ts.map +1 -0
- package/dist/config/RspackOptions.js +3 -0
- package/dist/config/RspackOptions.js.map +1 -0
- package/dist/config/browserslistTargetHandler.d.ts +20 -0
- package/dist/config/browserslistTargetHandler.d.ts.map +1 -0
- package/dist/config/browserslistTargetHandler.js +320 -0
- package/dist/config/browserslistTargetHandler.js.map +1 -0
- package/dist/config/builtins.d.ts +16 -0
- package/dist/config/builtins.d.ts.map +1 -0
- package/dist/config/builtins.js +50 -0
- package/dist/config/builtins.js.map +1 -0
- package/dist/config/context.d.ts +3 -0
- package/dist/config/context.d.ts.map +1 -0
- package/dist/config/context.js +3 -0
- package/dist/config/context.js.map +1 -0
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +58 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/devServer.d.ts +22 -0
- package/dist/config/devServer.d.ts.map +1 -0
- package/dist/config/devServer.js +3 -0
- package/dist/config/devServer.js.map +1 -0
- package/dist/config/devtool.d.ts +5 -0
- package/dist/config/devtool.d.ts.map +1 -0
- package/dist/config/devtool.js +13 -0
- package/dist/config/devtool.js.map +1 -0
- package/dist/config/entry.d.ts +8 -0
- package/dist/config/entry.d.ts.map +1 -0
- package/dist/config/entry.js +39 -0
- package/dist/config/entry.js.map +1 -0
- package/dist/config/external.d.ts +5 -0
- package/dist/config/external.d.ts.map +1 -0
- package/dist/config/external.js +3 -0
- package/dist/config/external.js.map +1 -0
- package/dist/config/index.d.ts +57 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +55 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/mode.d.ts +3 -0
- package/dist/config/mode.d.ts.map +1 -0
- package/dist/config/mode.js +3 -0
- package/dist/config/mode.js.map +1 -0
- package/dist/config/module.d.ts +83 -0
- package/dist/config/module.d.ts.map +1 -0
- package/dist/config/module.js +251 -0
- package/dist/config/module.js.map +1 -0
- package/dist/config/output.d.ts +23 -0
- package/dist/config/output.d.ts.map +1 -0
- package/dist/config/output.js +10 -0
- package/dist/config/output.js.map +1 -0
- package/dist/config/plugin.d.ts +6 -0
- package/dist/config/plugin.d.ts.map +1 -0
- package/dist/config/plugin.js +3 -0
- package/dist/config/plugin.js.map +1 -0
- package/dist/config/resolve.d.ts +27 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resolve.js +37 -0
- package/dist/config/resolve.js.map +1 -0
- package/dist/config/stats.d.ts +21 -0
- package/dist/config/stats.d.ts.map +1 -0
- package/dist/config/stats.js +17 -0
- package/dist/config/stats.js.map +1 -0
- package/dist/config/target.d.ts +7 -0
- package/dist/config/target.d.ts.map +1 -0
- package/dist/config/target.js +21 -0
- package/dist/config/target.js.map +1 -0
- package/dist/config/watch.d.ts +8 -0
- package/dist/config/watch.d.ts.map +1 -0
- package/dist/config/watch.js +16 -0
- package/dist/config/watch.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/Logger.d.ts +43 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +136 -0
- package/dist/logging/Logger.js.map +1 -0
- package/dist/logging/createConsoleLogger.d.ts +7 -0
- package/dist/logging/createConsoleLogger.d.ts.map +1 -0
- package/dist/logging/createConsoleLogger.js +227 -0
- package/dist/logging/createConsoleLogger.js.map +1 -0
- package/dist/logging/runtime.d.ts +14 -0
- package/dist/logging/runtime.d.ts.map +1 -0
- package/dist/logging/runtime.js +42 -0
- package/dist/logging/runtime.js.map +1 -0
- package/dist/logging/truncateArgs.d.ts +8 -0
- package/dist/logging/truncateArgs.d.ts.map +1 -0
- package/dist/logging/truncateArgs.js +81 -0
- package/dist/logging/truncateArgs.js.map +1 -0
- package/dist/node/NodeTargetPlugin.d.ts +5 -0
- package/dist/node/NodeTargetPlugin.d.ts.map +1 -0
- package/dist/node/NodeTargetPlugin.js +70 -0
- package/dist/node/NodeTargetPlugin.js.map +1 -0
- package/dist/node/nodeConsole.d.ts +22 -0
- package/dist/node/nodeConsole.d.ts.map +1 -0
- package/dist/node/nodeConsole.js +121 -0
- package/dist/node/nodeConsole.js.map +1 -0
- package/dist/rspack.d.ts +8 -0
- package/dist/rspack.d.ts.map +1 -0
- package/dist/rspack.js +59 -0
- package/dist/rspack.js.map +1 -0
- package/dist/rspackOptionsApply.d.ts +6 -0
- package/dist/rspackOptionsApply.d.ts.map +1 -0
- package/dist/rspackOptionsApply.js +23 -0
- package/dist/rspackOptionsApply.js.map +1 -0
- package/dist/stats.d.ts +23 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +871 -0
- package/dist/stats.js.map +1 -0
- package/dist/utils/createHash.d.ts +7 -0
- package/dist/utils/createHash.d.ts.map +1 -0
- package/dist/utils/createHash.js +166 -0
- package/dist/utils/createHash.js.map +1 -0
- package/dist/utils/createSource.d.ts +6 -0
- package/dist/utils/createSource.d.ts.map +1 -0
- package/dist/utils/createSource.js +48 -0
- package/dist/utils/createSource.js.map +1 -0
- package/dist/utils/hash/BatchedHash.d.ts +16 -0
- package/dist/utils/hash/BatchedHash.d.ts.map +1 -0
- package/dist/utils/hash/BatchedHash.js +61 -0
- package/dist/utils/hash/BatchedHash.js.map +1 -0
- package/dist/utils/hash/index.d.ts +19 -0
- package/dist/utils/hash/index.d.ts.map +1 -0
- package/dist/utils/hash/index.js +28 -0
- package/dist/utils/hash/index.js.map +1 -0
- package/dist/utils/hash/md4.d.ts +3 -0
- package/dist/utils/hash/md4.d.ts.map +1 -0
- package/dist/utils/hash/md4.js +13 -0
- package/dist/utils/hash/md4.js.map +1 -0
- package/dist/utils/hash/wasm-hash.d.ts +7 -0
- package/dist/utils/hash/wasm-hash.d.ts.map +1 -0
- package/dist/utils/hash/wasm-hash.js +162 -0
- package/dist/utils/hash/wasm-hash.js.map +1 -0
- package/dist/utils/hash/xxhash64.d.ts +3 -0
- package/dist/utils/hash/xxhash64.d.ts.map +1 -0
- package/dist/utils/hash/xxhash64.js +13 -0
- package/dist/utils/hash/xxhash64.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/memoize.d.ts +2 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/memoize.js +22 -0
- package/dist/utils/memoize.js.map +1 -0
- package/dist/web/ResolveSwcPlugin.d.ts +5 -0
- package/dist/web/ResolveSwcPlugin.d.ts.map +1 -0
- package/dist/web/ResolveSwcPlugin.js +21 -0
- package/dist/web/ResolveSwcPlugin.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# rspack
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_group.d.ts","sourceRoot":"","sources":["../src/chunk_group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,UAAU;;gBAGV,KAAK,EAAE,YAAY;IAI/B,QAAQ,IAAI,MAAM,EAAE;CAWpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _ChunkGroup_inner;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ChunkGroup = void 0;
|
|
16
|
+
class ChunkGroup {
|
|
17
|
+
constructor(inner) {
|
|
18
|
+
_ChunkGroup_inner.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _ChunkGroup_inner, inner, "f");
|
|
20
|
+
}
|
|
21
|
+
getFiles() {
|
|
22
|
+
const files = new Set();
|
|
23
|
+
for (const chunk of __classPrivateFieldGet(this, _ChunkGroup_inner, "f").chunks) {
|
|
24
|
+
for (const file of chunk.files) {
|
|
25
|
+
files.add(file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return Array.from(files);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ChunkGroup = ChunkGroup;
|
|
32
|
+
_ChunkGroup_inner = new WeakMap();
|
|
33
|
+
//# sourceMappingURL=chunk_group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_group.js","sourceRoot":"","sources":["../src/chunk_group.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,MAAa,UAAU;IAGtB,YAAY,KAAmB;QAF/B,oCAAqB;QAGpB,uBAAA,IAAI,qBAAU,KAAK,MAAA,CAAC;IACrB,CAAC;IAED,QAAQ;QACP,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAEhC,KAAK,MAAM,KAAK,IAAI,uBAAA,IAAI,yBAAO,CAAC,MAAM,EAAE;YACvC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;gBAC/B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAChB;SACD;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACD;AAlBD,gCAkBC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as tapable from "tapable";
|
|
2
|
+
import { Source } from "webpack-sources";
|
|
3
|
+
import { JsCompilation, JsAssetInfo } from "@rspack/binding";
|
|
4
|
+
import { RspackOptionsNormalized } from "./config";
|
|
5
|
+
import { ResolvedOutput } from "./config/output";
|
|
6
|
+
import { ChunkGroup } from "./chunk_group";
|
|
7
|
+
import { Compiler } from "./compiler";
|
|
8
|
+
export declare class Compilation {
|
|
9
|
+
#private;
|
|
10
|
+
hooks: {
|
|
11
|
+
processAssets: tapable.AsyncSeriesHook<Record<string, Source>>;
|
|
12
|
+
};
|
|
13
|
+
fullHash: string;
|
|
14
|
+
hash: string;
|
|
15
|
+
options: RspackOptionsNormalized;
|
|
16
|
+
outputOptions: ResolvedOutput;
|
|
17
|
+
compiler: Compiler;
|
|
18
|
+
constructor(compiler: Compiler, inner: JsCompilation);
|
|
19
|
+
/**
|
|
20
|
+
* Get a map of all assets.
|
|
21
|
+
*
|
|
22
|
+
* Source: [assets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L1008-L1009)
|
|
23
|
+
*/
|
|
24
|
+
get assets(): Record<string, Source>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a map of all entrypoints.
|
|
27
|
+
*/
|
|
28
|
+
get entrypoints(): Map<string, ChunkGroup>;
|
|
29
|
+
/**
|
|
30
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
31
|
+
*
|
|
32
|
+
* See: [Compilation.updateAsset](https://webpack.js.org/api/compilation-object/#updateasset)
|
|
33
|
+
* Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
|
|
34
|
+
*
|
|
35
|
+
* FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
|
|
36
|
+
*
|
|
37
|
+
* @param {string} file file name
|
|
38
|
+
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
|
39
|
+
* @param {JsAssetInfo | function(JsAssetInfo): JsAssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
|
40
|
+
*/
|
|
41
|
+
updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void;
|
|
42
|
+
/**
|
|
43
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
44
|
+
*
|
|
45
|
+
* See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset)
|
|
46
|
+
* Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239)
|
|
47
|
+
*
|
|
48
|
+
* @param {string} file file name
|
|
49
|
+
* @param {Source} source asset source
|
|
50
|
+
* @param {JsAssetInfo} assetInfo extra asset information
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
emitAsset(filename: string, source: Source, assetInfo?: JsAssetInfo): void;
|
|
54
|
+
deleteAsset(filename: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get an array of Asset
|
|
57
|
+
*
|
|
58
|
+
* See: [Compilation.getAssets](https://webpack.js.org/api/compilation-object/#getassets)
|
|
59
|
+
* Source: [getAssets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4448)
|
|
60
|
+
*
|
|
61
|
+
* @return {Readonly<JsAsset>[]}
|
|
62
|
+
*/
|
|
63
|
+
getAssets(): {
|
|
64
|
+
source: Source;
|
|
65
|
+
name: string;
|
|
66
|
+
info: JsAssetInfo;
|
|
67
|
+
}[];
|
|
68
|
+
getAsset(name: string): {
|
|
69
|
+
source: Source;
|
|
70
|
+
name: string;
|
|
71
|
+
info: JsAssetInfo;
|
|
72
|
+
};
|
|
73
|
+
getPath(filename: string, data?: Record<string, any>): any;
|
|
74
|
+
getAssetPath(filename: any, data: any): any;
|
|
75
|
+
createStats(): {};
|
|
76
|
+
seal(): void;
|
|
77
|
+
unseal(): void;
|
|
78
|
+
}
|
|
79
|
+
export type { JsAssetInfo };
|
|
80
|
+
//# sourceMappingURL=compilation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilation.d.ts","sourceRoot":"","sources":["../src/compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EACN,aAAa,EACb,WAAW,EAGX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,qBAAa,WAAW;;IAGvB,KAAK,EAAE;QACN,aAA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
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
29
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _Compilation_inner;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.Compilation = void 0;
|
|
39
|
+
const tapable = __importStar(require("tapable"));
|
|
40
|
+
const createHash_1 = require("./utils/createHash");
|
|
41
|
+
const createSource_1 = require("./utils/createSource");
|
|
42
|
+
const chunk_group_1 = require("./chunk_group");
|
|
43
|
+
const hashDigestLength = 8;
|
|
44
|
+
const EMPTY_ASSET_INFO = {};
|
|
45
|
+
class Compilation {
|
|
46
|
+
constructor(compiler, inner) {
|
|
47
|
+
_Compilation_inner.set(this, void 0);
|
|
48
|
+
this.hooks = {
|
|
49
|
+
processAssets: new tapable.AsyncSeriesHook([
|
|
50
|
+
"assets"
|
|
51
|
+
])
|
|
52
|
+
};
|
|
53
|
+
this.compiler = compiler;
|
|
54
|
+
this.options = compiler.options;
|
|
55
|
+
this.outputOptions = compiler.options.output;
|
|
56
|
+
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
57
|
+
this.fullHash = hash.digest(this.options.output.hashDigest);
|
|
58
|
+
this.hash = this.fullHash.slice(0, hashDigestLength);
|
|
59
|
+
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get a map of all assets.
|
|
63
|
+
*
|
|
64
|
+
* Source: [assets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L1008-L1009)
|
|
65
|
+
*/
|
|
66
|
+
get assets() {
|
|
67
|
+
const iterator = Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").assets).map(([filename, source]) => [filename, (0, createSource_1.createSourceFromRaw)(source)]);
|
|
68
|
+
return Object.fromEntries(iterator);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get a map of all entrypoints.
|
|
72
|
+
*/
|
|
73
|
+
get entrypoints() {
|
|
74
|
+
return new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
|
|
75
|
+
n,
|
|
76
|
+
new chunk_group_1.ChunkGroup(e)
|
|
77
|
+
]));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
81
|
+
*
|
|
82
|
+
* See: [Compilation.updateAsset](https://webpack.js.org/api/compilation-object/#updateasset)
|
|
83
|
+
* Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
|
|
84
|
+
*
|
|
85
|
+
* FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
|
|
86
|
+
*
|
|
87
|
+
* @param {string} file file name
|
|
88
|
+
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
|
89
|
+
* @param {JsAssetInfo | function(JsAssetInfo): JsAssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
|
90
|
+
*/
|
|
91
|
+
updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
|
|
92
|
+
let compatNewSourceOrFunction;
|
|
93
|
+
if (typeof newSourceOrFunction === "function") {
|
|
94
|
+
compatNewSourceOrFunction = function newSourceFunction(source) {
|
|
95
|
+
return (0, createSource_1.createRawFromSource)(newSourceOrFunction((0, createSource_1.createSourceFromRaw)(source)));
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
compatNewSourceOrFunction = (0, createSource_1.createRawFromSource)(newSourceOrFunction);
|
|
100
|
+
}
|
|
101
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
105
|
+
*
|
|
106
|
+
* See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset)
|
|
107
|
+
* Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239)
|
|
108
|
+
*
|
|
109
|
+
* @param {string} file file name
|
|
110
|
+
* @param {Source} source asset source
|
|
111
|
+
* @param {JsAssetInfo} assetInfo extra asset information
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
emitAsset(filename, source, assetInfo = {
|
|
115
|
+
minimized: false,
|
|
116
|
+
development: false,
|
|
117
|
+
hotModuleReplacement: false,
|
|
118
|
+
related: {}
|
|
119
|
+
}) {
|
|
120
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAsset(filename, (0, createSource_1.createRawFromSource)(source), assetInfo);
|
|
121
|
+
}
|
|
122
|
+
deleteAsset(filename) {
|
|
123
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").deleteAsset(filename);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get an array of Asset
|
|
127
|
+
*
|
|
128
|
+
* See: [Compilation.getAssets](https://webpack.js.org/api/compilation-object/#getassets)
|
|
129
|
+
* Source: [getAssets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4448)
|
|
130
|
+
*
|
|
131
|
+
* @return {Readonly<JsAsset>[]}
|
|
132
|
+
*/
|
|
133
|
+
getAssets() {
|
|
134
|
+
const assets = __classPrivateFieldGet(this, _Compilation_inner, "f").getAssets();
|
|
135
|
+
return assets.map(asset => {
|
|
136
|
+
const source = (0, createSource_1.createSourceFromRaw)(asset.source);
|
|
137
|
+
return {
|
|
138
|
+
...asset,
|
|
139
|
+
source
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getAsset(name) {
|
|
144
|
+
const asset = __classPrivateFieldGet(this, _Compilation_inner, "f").getAsset(name);
|
|
145
|
+
if (!asset) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...asset,
|
|
150
|
+
source: (0, createSource_1.createSourceFromRaw)(asset.source)
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// TODO: full alignment
|
|
154
|
+
getPath(filename, data = {}) {
|
|
155
|
+
if (!data.hash) {
|
|
156
|
+
data = {
|
|
157
|
+
hash: this.hash,
|
|
158
|
+
...data
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return this.getAssetPath(filename, data);
|
|
162
|
+
}
|
|
163
|
+
// TODO: full alignment
|
|
164
|
+
getAssetPath(filename, data) {
|
|
165
|
+
return filename;
|
|
166
|
+
}
|
|
167
|
+
createStats() {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
seal() { }
|
|
171
|
+
unseal() { }
|
|
172
|
+
}
|
|
173
|
+
exports.Compilation = Compilation;
|
|
174
|
+
_Compilation_inner = new WeakMap();
|
|
175
|
+
//# sourceMappingURL=compilation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilation.js","sourceRoot":"","sources":["../src/compilation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAUnC,mDAAgD;AAEhD,uDAAgF;AAEhF,+CAA2C;AAG3C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,MAAa,WAAW;IAYvB,YAAY,QAAkB,EAAE,KAAoB;QAXpD,qCAAsB;QAYrB,IAAI,CAAC,KAAK,GAAG;YACZ,aAAa,EAAE,IAAI,OAAO,CAAC,eAAe,CAAyB;gBAClE,QAAQ;aACR,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC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R,MAAM,EAAE,IAAA,kCAAmB,EAAC,KAAK,CAAC,MAAM,CAAC;SACzC,CAAC;IACH,CAAC;IAED,uBAAuB;IACvB,OAAO,CAAC,QAAgB,EAAE,OAA4B,EAAE;QACvD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACf,IAAI,GAAG;gBACN,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,IAAI;aACP,CAAC;SACF;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,uBAAuB;IACvB,YAAY,CAAC,QAAQ,EAAE,IAAI;QAC1B,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,WAAW;QACV,OAAO,EAAE,CAAC;IACX,CAAC;IAED,IAAI,KAAI,CAAC;IACT,MAAM,KAAI,CAAC;CACX;AA/KD,kCA+KC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as tapable from "tapable";
|
|
2
|
+
import { Callback } from "tapable";
|
|
3
|
+
import * as binding from "@rspack/binding";
|
|
4
|
+
import { Logger } from "./logging/Logger";
|
|
5
|
+
import type { Watch } from "./config/watch";
|
|
6
|
+
import { RspackOptionsNormalized } from "./config";
|
|
7
|
+
import { Stats } from "./stats";
|
|
8
|
+
import { Compilation } from "./compilation";
|
|
9
|
+
declare class Compiler {
|
|
10
|
+
#private;
|
|
11
|
+
webpack: any;
|
|
12
|
+
compilation: Compilation;
|
|
13
|
+
infrastructureLogger: any;
|
|
14
|
+
outputPath: string;
|
|
15
|
+
name: string;
|
|
16
|
+
inputFileSystem: any;
|
|
17
|
+
outputFileSystem: any;
|
|
18
|
+
context: string;
|
|
19
|
+
hooks: {
|
|
20
|
+
done: tapable.AsyncSeriesHook<Stats>;
|
|
21
|
+
afterDone: tapable.SyncHook<Stats>;
|
|
22
|
+
compilation: tapable.SyncHook<Compilation>;
|
|
23
|
+
thisCompilation: tapable.SyncHook<[Compilation]>;
|
|
24
|
+
invalid: tapable.SyncHook<[string | null, number]>;
|
|
25
|
+
compile: tapable.SyncHook<[any]>;
|
|
26
|
+
initialize: tapable.SyncHook<[]>;
|
|
27
|
+
infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>;
|
|
28
|
+
beforeRun: tapable.AsyncSeriesHook<[Compiler]>;
|
|
29
|
+
run: tapable.AsyncSeriesHook<[Compiler]>;
|
|
30
|
+
failed: tapable.SyncHook<[Error]>;
|
|
31
|
+
watchRun: tapable.AsyncSeriesHook<[Compiler]>;
|
|
32
|
+
};
|
|
33
|
+
options: RspackOptionsNormalized;
|
|
34
|
+
constructor(context: string, options: RspackOptionsNormalized);
|
|
35
|
+
getInfrastructureLogger(name: string | Function): Logger;
|
|
36
|
+
run(callback: any): void;
|
|
37
|
+
build(cb: Callback<Error, binding.JsStatsCompilation>): void;
|
|
38
|
+
rebuild(changedFiles: string[], cb: (error?: Error, stats?: binding.JsStatsCompilation) => void): void;
|
|
39
|
+
watch(watchOptions?: Watch): Promise<Watching>;
|
|
40
|
+
purgeInputFileSystem(): void;
|
|
41
|
+
/**
|
|
42
|
+
* @todo
|
|
43
|
+
*/
|
|
44
|
+
close(callback: any): void;
|
|
45
|
+
emitAssets(compilation: Compilation, callback: any): void;
|
|
46
|
+
}
|
|
47
|
+
export interface Watching {
|
|
48
|
+
close(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export { Compiler };
|
|
51
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAA0B,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI3D,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE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