@rspack/core 0.0.0-1bce45e7c0-20221109113710
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/compilation.d.ts +64 -0
- package/dist/compilation.d.ts.map +1 -0
- package/dist/compilation.js +148 -0
- package/dist/compilation.js.map +1 -0
- package/dist/compiler.d.ts +52 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +397 -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 +14 -0
- package/dist/config/builtins.d.ts.map +1 -0
- package/dist/config/builtins.js +35 -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 +57 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/devServer.d.ts +21 -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 +56 -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 +79 -0
- package/dist/config/module.d.ts.map +1 -0
- package/dist/config/module.js +120 -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 +22 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resolve.js +33 -0
- package/dist/config/resolve.js.map +1 -0
- package/dist/config/stats.d.ts +10 -0
- package/dist/config/stats.d.ts.map +1 -0
- package/dist/config/stats.js +16 -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 +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -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 +25 -0
- package/dist/rspackOptionsApply.js.map +1 -0
- package/dist/stats.d.ts +11 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +773 -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 +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -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/polyfillBuiltins.d.ts +5 -0
- package/dist/web/polyfillBuiltins.d.ts.map +1 -0
- package/dist/web/polyfillBuiltins.js +43 -0
- package/dist/web/polyfillBuiltins.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# rspack
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as tapable from "tapable";
|
|
2
|
+
import { Source } from "webpack-sources";
|
|
3
|
+
import { JsCompilation, AssetInfo } from "@rspack/binding";
|
|
4
|
+
import { RspackOptionsNormalized } from "./config";
|
|
5
|
+
export declare class Compilation {
|
|
6
|
+
#private;
|
|
7
|
+
hooks: {
|
|
8
|
+
processAssets: tapable.AsyncSeriesHook<Record<string, Source>>;
|
|
9
|
+
};
|
|
10
|
+
fullHash: string;
|
|
11
|
+
hash: string;
|
|
12
|
+
options: RspackOptionsNormalized;
|
|
13
|
+
constructor(options: RspackOptionsNormalized, inner: JsCompilation);
|
|
14
|
+
/**
|
|
15
|
+
* Get a map of all assets.
|
|
16
|
+
*
|
|
17
|
+
* Source: [assets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L1008-L1009)
|
|
18
|
+
*/
|
|
19
|
+
get assets(): Record<string, Source>;
|
|
20
|
+
/**
|
|
21
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
22
|
+
*
|
|
23
|
+
* See: [Compilation.updateAsset](https://webpack.js.org/api/compilation-object/#updateasset)
|
|
24
|
+
* Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
|
|
25
|
+
*
|
|
26
|
+
* FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
|
|
27
|
+
*
|
|
28
|
+
* @param {string} file file name
|
|
29
|
+
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
|
30
|
+
* @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
|
31
|
+
*/
|
|
32
|
+
updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
|
|
33
|
+
/**
|
|
34
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
35
|
+
*
|
|
36
|
+
* See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset)
|
|
37
|
+
* Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239)
|
|
38
|
+
*
|
|
39
|
+
* @param {string} file file name
|
|
40
|
+
* @param {Source} source asset source
|
|
41
|
+
* @param {AssetInfo} assetInfo extra asset information
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get an array of Asset
|
|
47
|
+
*
|
|
48
|
+
* See: [Compilation.getAssets](https://webpack.js.org/api/compilation-object/#getassets)
|
|
49
|
+
* Source: [getAssets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4448)
|
|
50
|
+
*
|
|
51
|
+
* @return {Readonly<Asset>[]}
|
|
52
|
+
*/
|
|
53
|
+
getAssets(): {
|
|
54
|
+
source: Source;
|
|
55
|
+
name: string;
|
|
56
|
+
info: AssetInfo;
|
|
57
|
+
}[];
|
|
58
|
+
getPath(filename: string, data?: Record<string, any>): any;
|
|
59
|
+
getAssetPath(filename: any, data: any): any;
|
|
60
|
+
createStats(): {};
|
|
61
|
+
seal(): void;
|
|
62
|
+
unseal(): void;
|
|
63
|
+
}
|
|
64
|
+
//# 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,EAAE,aAAa,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAKnD,qBAAa,WAAW;;IAGvB,KAAK,EAAE;QACN,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KAC/D,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,uBAAuB,CAAC;gBAErB,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,aAAa;IAalE;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnC;IAED;;;;;;;;;;;OAWG;IACH,WAAW,CACV,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,EAC1D,yBAAyB,EAAE,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC;IAyB7E;;;;;;;;;;OAUG;IACH,SAAS,CACR,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAIV;IAKF;;;;;;;OAOG;IACH,SAAS;;;;;IAaT,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAWxD,YAAY,CAAC,QAAQ,KAAA,EAAE,IAAI,KAAA;IAI3B,WAAW;IAIX,IAAI;IACJ,MAAM;CACN"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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 hashDigestLength = 8;
|
|
43
|
+
class Compilation {
|
|
44
|
+
constructor(options, inner) {
|
|
45
|
+
_Compilation_inner.set(this, void 0);
|
|
46
|
+
this.hooks = {
|
|
47
|
+
processAssets: new tapable.AsyncSeriesHook([
|
|
48
|
+
"assets"
|
|
49
|
+
])
|
|
50
|
+
};
|
|
51
|
+
this.options = options;
|
|
52
|
+
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
53
|
+
this.fullHash = hash.digest(options.output.hashDigest);
|
|
54
|
+
this.hash = this.fullHash.slice(0, hashDigestLength);
|
|
55
|
+
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a map of all assets.
|
|
59
|
+
*
|
|
60
|
+
* Source: [assets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L1008-L1009)
|
|
61
|
+
*/
|
|
62
|
+
get assets() {
|
|
63
|
+
const iterator = Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").assets).map(([filename, source]) => [filename, (0, createSource_1.createSourceFromRaw)(source)]);
|
|
64
|
+
return Object.fromEntries(iterator);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
68
|
+
*
|
|
69
|
+
* See: [Compilation.updateAsset](https://webpack.js.org/api/compilation-object/#updateasset)
|
|
70
|
+
* Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
|
|
71
|
+
*
|
|
72
|
+
* FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
|
|
73
|
+
*
|
|
74
|
+
* @param {string} file file name
|
|
75
|
+
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
|
76
|
+
* @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
|
77
|
+
*/
|
|
78
|
+
updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
|
|
79
|
+
let compatNewSourceOrFunction;
|
|
80
|
+
if (typeof newSourceOrFunction === "function") {
|
|
81
|
+
compatNewSourceOrFunction = function newSourceFunction(source) {
|
|
82
|
+
return (0, createSource_1.createRawFromSource)(newSourceOrFunction((0, createSource_1.createSourceFromRaw)(source)));
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
compatNewSourceOrFunction = (0, createSource_1.createRawFromSource)(newSourceOrFunction);
|
|
87
|
+
}
|
|
88
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
92
|
+
*
|
|
93
|
+
* See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset)
|
|
94
|
+
* Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239)
|
|
95
|
+
*
|
|
96
|
+
* @param {string} file file name
|
|
97
|
+
* @param {Source} source asset source
|
|
98
|
+
* @param {AssetInfo} assetInfo extra asset information
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
emitAsset(filename, source, assetInfo = {
|
|
102
|
+
minimized: false,
|
|
103
|
+
development: false,
|
|
104
|
+
related: {}
|
|
105
|
+
}) {
|
|
106
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAsset(filename, (0, createSource_1.createRawFromSource)(source), assetInfo);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get an array of Asset
|
|
110
|
+
*
|
|
111
|
+
* See: [Compilation.getAssets](https://webpack.js.org/api/compilation-object/#getassets)
|
|
112
|
+
* Source: [getAssets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4448)
|
|
113
|
+
*
|
|
114
|
+
* @return {Readonly<Asset>[]}
|
|
115
|
+
*/
|
|
116
|
+
getAssets() {
|
|
117
|
+
const assets = __classPrivateFieldGet(this, _Compilation_inner, "f").getAssets();
|
|
118
|
+
return assets.map(asset => {
|
|
119
|
+
const source = (0, createSource_1.createSourceFromRaw)(asset.source);
|
|
120
|
+
return {
|
|
121
|
+
...asset,
|
|
122
|
+
source
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// TODO: full alignment
|
|
127
|
+
getPath(filename, data = {}) {
|
|
128
|
+
if (!data.hash) {
|
|
129
|
+
data = {
|
|
130
|
+
hash: this.hash,
|
|
131
|
+
...data
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return this.getAssetPath(filename, data);
|
|
135
|
+
}
|
|
136
|
+
// TODO: full alignment
|
|
137
|
+
getAssetPath(filename, data) {
|
|
138
|
+
return filename;
|
|
139
|
+
}
|
|
140
|
+
createStats() {
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
143
|
+
seal() { }
|
|
144
|
+
unseal() { }
|
|
145
|
+
}
|
|
146
|
+
exports.Compilation = Compilation;
|
|
147
|
+
_Compilation_inner = new WeakMap();
|
|
148
|
+
//# sourceMappingURL=compilation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilation.js","sourceRoot":"","sources":["../src/compilation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAKnC,mDAAgD;AAEhD,uDAAgF;AAEhF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAa,WAAW;IAUvB,YAAY,OAAgC,EAAE,KAAoB;QATlE,qCAAsB;QAUrB,IAAI,CAAC,KAAK,GAAG;YACZ,aAAa,EAAE,IAAI,OAAO,CAAC,eAAe,CAAyB;gBAClE,QAAQ;aACR,CAAC;SACF,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC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CAAmB,EAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;OAOG;IACH,SAAS;QACR,MAAM,MAAM,GAAG,uBAAA,IAAI,0BAAO,CAAC,SAAS,EAAE,CAAC;QAEvC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACzB,MAAM,MAAM,GAAG,IAAA,kCAAmB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjD,OAAO;gBACN,GAAG,KAAK;gBACR,MAAM;aACN,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,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;AA7ID,kCA6IC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
hooks: {
|
|
19
|
+
done: tapable.AsyncSeriesHook<Stats>;
|
|
20
|
+
afterDone: tapable.SyncHook<Stats>;
|
|
21
|
+
compilation: tapable.SyncHook<Compilation>;
|
|
22
|
+
thisCompilation: tapable.SyncHook<[Compilation]>;
|
|
23
|
+
invalid: tapable.SyncHook<[string | null, number]>;
|
|
24
|
+
compile: tapable.SyncHook<[any]>;
|
|
25
|
+
initialize: tapable.SyncHook<[]>;
|
|
26
|
+
infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>;
|
|
27
|
+
beforeRun: tapable.AsyncSeriesHook<[Compiler]>;
|
|
28
|
+
run: tapable.AsyncSeriesHook<[Compiler]>;
|
|
29
|
+
failed: tapable.SyncHook<[Error]>;
|
|
30
|
+
};
|
|
31
|
+
options: RspackOptionsNormalized;
|
|
32
|
+
constructor(context: string, options: RspackOptionsNormalized);
|
|
33
|
+
getInfrastructureLogger(name: string | Function): Logger;
|
|
34
|
+
run(callback: any): void;
|
|
35
|
+
build(cb: Callback<Error, binding.StatsCompilation>): void;
|
|
36
|
+
rebuild(changedFiles: string[], cb: (error?: Error, stats?: {
|
|
37
|
+
diff: binding.DiffStat;
|
|
38
|
+
stats: binding.StatsCompilation;
|
|
39
|
+
}) => void): void;
|
|
40
|
+
watch(watchOptions?: Watch, ws?: any): Promise<Watching>;
|
|
41
|
+
purgeInputFileSystem(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @todo
|
|
44
|
+
*/
|
|
45
|
+
close(callback: any): void;
|
|
46
|
+
emitAssets(compilation: Compilation, callback: any): void;
|
|
47
|
+
}
|
|
48
|
+
export interface Watching {
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export { Compiler };
|
|
52
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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