@rspack/core 0.0.6 → 0.0.8
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/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 +383 -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/{lib/config/define.js → dist/config/RspackOptions.js} +1 -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 +15 -0
- package/dist/config/builtins.d.ts.map +1 -0
- package/dist/config/builtins.js +49 -0
- package/dist/config/builtins.js.map +1 -0
- package/{lib → dist}/config/context.d.ts +1 -0
- package/dist/config/context.d.ts.map +1 -0
- package/{lib → dist}/config/context.js +1 -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/{lib/config/builtins.js → dist/config/devServer.js} +1 -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/{lib → dist}/config/external.js +1 -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/{lib → dist}/config/mode.d.ts +1 -0
- package/dist/config/mode.d.ts.map +1 -0
- package/{lib → dist}/config/mode.js +1 -0
- package/dist/config/mode.js.map +1 -0
- package/{lib → dist}/config/module.d.ts +22 -7
- package/dist/config/module.d.ts.map +1 -0
- package/{lib → dist}/config/module.js +29 -21
- package/dist/config/module.js.map +1 -0
- package/{lib → dist}/config/output.d.ts +6 -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/{lib → dist}/config/plugin.js +1 -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 +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 +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 +21 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +870 -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 +28 -23
- package/CHANGELOG.md +0 -41
- package/bin.js +0 -1
- package/example/basic.ts +0 -71
- package/example/react-example/index.html +0 -12
- package/example/react-example/package.json +0 -17
- package/example/react-example/rspack.config.json +0 -13
- package/example/react-example/src/app.jsx +0 -44
- package/example/react-example/src/base.css +0 -9
- package/example/react-example/src/button.jsx +0 -3
- package/example/react-example/src/dark.svg +0 -1
- package/example/react-example/src/data.json +0 -5
- package/example/react-example/src/file.jpg +0 -0
- package/example/react-example/src/file.png +0 -0
- package/example/react-example/src/file.svg +0 -1
- package/example/react-example/src/foo.css +0 -3
- package/example/react-example/src/index.html +0 -32
- package/example/react-example/src/index.js +0 -1
- package/example/react-example/src/light.svg +0 -48
- package/example/react-example/src/logo.svg +0 -18
- package/example/react-with-sass.ts +0 -28
- package/lib/bin/index.d.ts +0 -1
- package/lib/bin/index.js +0 -32
- package/lib/build.d.ts +0 -1
- package/lib/build.js +0 -12
- package/lib/config/builtins.d.ts +0 -3
- package/lib/config/define.d.ts +0 -2
- package/lib/config/dev.d.ts +0 -17
- package/lib/config/dev.js +0 -17
- package/lib/config/entry.d.ts +0 -2
- package/lib/config/entry.js +0 -2
- package/lib/config/external.d.ts +0 -2
- package/lib/config/index.d.ts +0 -45
- package/lib/config/index.js +0 -37
- package/lib/config/output.js +0 -14
- package/lib/config/plugin.d.ts +0 -5
- package/lib/config/resolve.d.ts +0 -6
- package/lib/config/resolve.js +0 -2
- package/lib/config/target.d.ts +0 -5
- package/lib/config/target.js +0 -13
- package/lib/index.d.ts +0 -39
- package/lib/index.js +0 -154
- package/lib/server/index.d.ts +0 -0
- package/lib/server/index.js +0 -0
- package/src/bin/index.ts +0 -36
- package/src/build.ts +0 -8
- package/src/config/builtins.ts +0 -5
- package/src/config/context.ts +0 -3
- package/src/config/define.ts +0 -3
- package/src/config/dev.ts +0 -32
- package/src/config/entry.ts +0 -3
- package/src/config/external.ts +0 -3
- package/src/config/index.ts +0 -80
- package/src/config/mode.ts +0 -2
- package/src/config/module.ts +0 -240
- package/src/config/output.ts +0 -29
- package/src/config/plugin.ts +0 -6
- package/src/config/resolve.ts +0 -6
- package/src/config/target.ts +0 -28
- package/src/index.ts +0 -140
- package/src/server/index.ts +0 -0
- package/tests/config.test.ts +0 -40
- package/tsconfig.json +0 -14
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<title>React App</title>
|
|
7
|
-
<script>
|
|
8
|
-
process = {
|
|
9
|
-
env: 'production'
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
<script src="./runtime.js"></script>
|
|
13
|
-
<link rel="stylesheet" href="./main.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
18
|
-
<div id="root"></div>
|
|
19
|
-
<!--
|
|
20
|
-
This HTML file is a template.
|
|
21
|
-
If you open it directly in the browser, you will see an empty page.
|
|
22
|
-
|
|
23
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
24
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
25
|
-
|
|
26
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
27
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
28
|
-
-->
|
|
29
|
-
</body>
|
|
30
|
-
<script src="./main.js"></script>
|
|
31
|
-
|
|
32
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./app.jsx";
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
-
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
|
4
|
-
y="0px" viewBox="0 0 22 22" style="enable-background:new 0 0 22 22;" xml:space="preserve">
|
|
5
|
-
<style type="text/css">
|
|
6
|
-
.st1 {
|
|
7
|
-
fill: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
body {
|
|
11
|
-
background: deepskyblue;
|
|
12
|
-
}
|
|
13
|
-
</style>
|
|
14
|
-
<title>编组 5备份</title>
|
|
15
|
-
<desc>Created with Sketch.</desc>
|
|
16
|
-
<g id="组件页-Web端-_xD83E__xDD1F_">
|
|
17
|
-
<g id="暗黑模式" transform="translate(2.500000, 2.500000)">
|
|
18
|
-
<g id="编组-12">
|
|
19
|
-
<g id="编组-8">
|
|
20
|
-
<g id="编组-7" transform="translate(7.285714, 0.000000)">
|
|
21
|
-
</g>
|
|
22
|
-
|
|
23
|
-
<g id="编组-7备份"
|
|
24
|
-
transform="translate(8.500000, 8.500000) rotate(-270.000000) translate(-8.500000, -8.500000) translate(7.285714, 0.000000)">
|
|
25
|
-
</g>
|
|
26
|
-
|
|
27
|
-
<g id="编组-7备份-2"
|
|
28
|
-
transform="translate(8.500000, 8.500000) rotate(-225.000000) translate(-8.500000, -8.500000) translate(7.285714, 0.000000)">
|
|
29
|
-
</g>
|
|
30
|
-
|
|
31
|
-
<g id="编组-7备份-3"
|
|
32
|
-
transform="translate(8.500000, 8.500000) rotate(-315.000000) translate(-8.500000, -8.500000) translate(7.285714, 0.000000)">
|
|
33
|
-
</g>
|
|
34
|
-
</g>
|
|
35
|
-
</g>
|
|
36
|
-
<path id="椭圆形" class="st0" d="M8.5,11.5c1.7,0,3-1.4,3-3s-1.4-3-3-3s-3,1.4-3,3S6.8,11.5,8.5,11.5z" />
|
|
37
|
-
<rect id="矩形" x="7.3" class="st0" width="2.4" height="2.4" />
|
|
38
|
-
<rect id="矩形备份-2" x="7.3" y="14.6" class="st0" width="2.4" height="2.4" />
|
|
39
|
-
<polygon id="矩形_1_" class="st0" points="17,7.3 17,9.7 14.6,9.7 14.6,7.3 " />
|
|
40
|
-
<polygon id="矩形备份-2_1_" class="st0" points="2.4,7.3 2.4,9.7 0,9.7 0,7.3 " />
|
|
41
|
-
<polygon id="矩形_2_" class="st0" points="15.4,13.7 13.7,15.4 11.9,13.7 13.7,11.9 " />
|
|
42
|
-
<polygon id="矩形备份-2_2_" class="st0" points="5.1,3.3 3.3,5.1 1.6,3.3 3.3,1.6 " />
|
|
43
|
-
<polygon id="矩形_3_" class="st0" points="13.7,1.6 15.4,3.3 13.7,5.1 11.9,3.3 " />
|
|
44
|
-
<polygon id="矩形备份-2_3_" class="st0" points="3.3,11.9 5.1,13.7 3.3,15.4 1.6,13.7 " />
|
|
45
|
-
</g>
|
|
46
|
-
</g>
|
|
47
|
-
<rect x="0" class="st1" width="22" height="22" />
|
|
48
|
-
</svg>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0)">
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
4
|
-
d="M5.37754 16.9795L12.7498 9.43027C14.7163 7.41663 17.9428 7.37837 19.9564 9.34482C19.9852 9.37297 20.0137 9.40145 20.0418 9.43027L20.1221 9.51243C22.1049 11.5429 22.1049 14.7847 20.1221 16.8152L12.7498 24.3644C10.7834 26.378 7.55686 26.4163 5.54322 24.4498C5.5144 24.4217 5.48592 24.3932 5.45777 24.3644L5.37754 24.2822C3.39468 22.2518 3.39468 19.0099 5.37754 16.9795Z"
|
|
5
|
-
fill="#12D2AC" />
|
|
6
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
7
|
-
d="M20.0479 9.43034L27.3399 16.8974C29.3674 18.9735 29.3674 22.2883 27.3399 24.3644C25.3735 26.3781 22.147 26.4163 20.1333 24.4499C20.1045 24.4217 20.076 24.3933 20.0479 24.3644L12.7558 16.8974C10.7284 14.8213 10.7284 11.5065 12.7558 9.43034C14.7223 7.4167 17.9488 7.37844 19.9624 9.34489C19.9912 9.37304 20.0197 9.40152 20.0479 9.43034Z"
|
|
8
|
-
fill="#307AF2" />
|
|
9
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
10
|
-
d="M20.1321 9.52163L23.6851 13.1599L16.3931 20.627L9.10103 13.1599L12.6541 9.52163C14.6707 7.45664 17.9794 7.4174 20.0444 9.434C20.074 9.46286 20.1032 9.49207 20.1321 9.52163Z"
|
|
11
|
-
fill="#0057FE" />
|
|
12
|
-
</g>
|
|
13
|
-
<defs>
|
|
14
|
-
<clipPath id="clip0">
|
|
15
|
-
<rect width="26" height="19" fill="white" transform="translate(3.5 7)" />
|
|
16
|
-
</clipPath>
|
|
17
|
-
</defs>
|
|
18
|
-
</svg>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { Rspack } from "../src";
|
|
3
|
-
|
|
4
|
-
const context = path.resolve(__dirname, "../../../examples/react-with-sass");
|
|
5
|
-
|
|
6
|
-
const rspack = new Rspack({
|
|
7
|
-
entry: {
|
|
8
|
-
main: path.resolve(context, "./src/index.jsx")
|
|
9
|
-
},
|
|
10
|
-
context,
|
|
11
|
-
plugins: ["html"],
|
|
12
|
-
module: {
|
|
13
|
-
rules: [
|
|
14
|
-
{
|
|
15
|
-
test: "\\.s[ac]ss$",
|
|
16
|
-
uses: [{ builtinLoader: "sass-loader" }],
|
|
17
|
-
type: "css"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
async function main() {
|
|
24
|
-
const stats = await rspack.build();
|
|
25
|
-
console.log(stats);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
main();
|
package/lib/bin/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/bin/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commander_1 = require("commander");
|
|
4
|
-
const dev_server_1 = require("@rspack/dev-server");
|
|
5
|
-
const __1 = require("..");
|
|
6
|
-
const build_1 = require("../build");
|
|
7
|
-
const program = new commander_1.Command();
|
|
8
|
-
program
|
|
9
|
-
.option("--env", "env")
|
|
10
|
-
.command("build", {
|
|
11
|
-
isDefault: true
|
|
12
|
-
})
|
|
13
|
-
.description("Rspack build cli")
|
|
14
|
-
.argument("<config-file>", "rspack config file path")
|
|
15
|
-
.action(async (configPath) => {
|
|
16
|
-
const config = require(configPath);
|
|
17
|
-
const stats = await (0, build_1.build)(config);
|
|
18
|
-
console.log(stats);
|
|
19
|
-
});
|
|
20
|
-
program
|
|
21
|
-
.command("dev")
|
|
22
|
-
.description("Rspack build cli")
|
|
23
|
-
.argument("<config-file>", "rspack config file path")
|
|
24
|
-
.action(async (configPath) => {
|
|
25
|
-
const config = require(configPath);
|
|
26
|
-
const rspack = new __1.Rspack(config);
|
|
27
|
-
const { options: { dev: { port = 8080 } = {} } = {} } = rspack;
|
|
28
|
-
await rspack.build();
|
|
29
|
-
const server = await (0, dev_server_1.createServer)(rspack.options);
|
|
30
|
-
server.listen(port, () => console.log(`Server listening on port: ${port}`));
|
|
31
|
-
});
|
|
32
|
-
program.parse();
|
package/lib/build.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function build(config: any): Promise<void>;
|
package/lib/build.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.build = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
async function build(config) {
|
|
6
|
-
const rspack = new _1.Rspack(config);
|
|
7
|
-
const stats = await rspack.build();
|
|
8
|
-
if (stats.errors.length > 0) {
|
|
9
|
-
throw new Error(stats.errors[0].message);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.build = build;
|
package/lib/config/builtins.d.ts
DELETED
package/lib/config/define.d.ts
DELETED
package/lib/config/dev.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface Dev {
|
|
2
|
-
port?: number;
|
|
3
|
-
static?: {
|
|
4
|
-
directory?: string;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
export interface ResolvedDev {
|
|
8
|
-
port: number;
|
|
9
|
-
static: {
|
|
10
|
-
directory: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
interface ResolveDevConfigContext {
|
|
14
|
-
context: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function resolveDevOptions(devConfig: Dev, context: ResolveDevConfigContext): ResolvedDev;
|
|
17
|
-
export {};
|
package/lib/config/dev.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveDevOptions = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
function resolveDevOptions(devConfig = {}, context) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
return {
|
|
11
|
-
port: (_a = devConfig.port) !== null && _a !== void 0 ? _a : 8080,
|
|
12
|
-
static: {
|
|
13
|
-
directory: (_c = (_b = devConfig.static) === null || _b === void 0 ? void 0 : _b.directory) !== null && _c !== void 0 ? _c : node_path_1.default.resolve(context.context, "dist")
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.resolveDevOptions = resolveDevOptions;
|
package/lib/config/entry.d.ts
DELETED
package/lib/config/entry.js
DELETED
package/lib/config/external.d.ts
DELETED
package/lib/config/index.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Context, ResolvedContext } from "./context";
|
|
2
|
-
import type { Define, ResolvedDefine } from "./define";
|
|
3
|
-
import type { Dev, ResolvedDev } from "./dev";
|
|
4
|
-
import type { Entry, ResolvedEntry } from "./entry";
|
|
5
|
-
import type { External, ResolvedExternal } from "./external";
|
|
6
|
-
import type { Mode, ResolvedMode } from "./mode";
|
|
7
|
-
import type { Module, ResolvedModule } from "./module";
|
|
8
|
-
import type { Plugin } from "./plugin";
|
|
9
|
-
import type { ResolvedTarget, Target } from "./target";
|
|
10
|
-
import type { Output, ResolvedOutput } from "./output";
|
|
11
|
-
import { Builtins, ResolvedBuiltins } from "./builtins";
|
|
12
|
-
import { Resolve, ResolvedResolve } from "./resolve";
|
|
13
|
-
export declare type Asset = {
|
|
14
|
-
source: string;
|
|
15
|
-
};
|
|
16
|
-
export declare type Assets = Record<string, Asset>;
|
|
17
|
-
export interface RspackOptions {
|
|
18
|
-
entry?: Entry;
|
|
19
|
-
context?: Context;
|
|
20
|
-
plugins?: Plugin[];
|
|
21
|
-
dev?: Dev;
|
|
22
|
-
module?: Module;
|
|
23
|
-
define?: Define;
|
|
24
|
-
target?: Target;
|
|
25
|
-
mode?: Mode;
|
|
26
|
-
external?: External;
|
|
27
|
-
output?: Output;
|
|
28
|
-
builtins: Builtins;
|
|
29
|
-
resolve: Resolve;
|
|
30
|
-
}
|
|
31
|
-
export interface ResolvedRspackOptions {
|
|
32
|
-
entry: ResolvedEntry;
|
|
33
|
-
context: ResolvedContext;
|
|
34
|
-
plugins: Plugin[];
|
|
35
|
-
dev: ResolvedDev;
|
|
36
|
-
module: ResolvedModule;
|
|
37
|
-
define: ResolvedDefine;
|
|
38
|
-
target: ResolvedTarget;
|
|
39
|
-
mode: ResolvedMode;
|
|
40
|
-
external: ResolvedExternal;
|
|
41
|
-
output: ResolvedOutput;
|
|
42
|
-
builtins: ResolvedBuiltins;
|
|
43
|
-
resolve: ResolvedResolve;
|
|
44
|
-
}
|
|
45
|
-
export declare function resolveOptions(config: RspackOptions): ResolvedRspackOptions;
|
package/lib/config/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveOptions = void 0;
|
|
4
|
-
const target_1 = require("./target");
|
|
5
|
-
const output_1 = require("./output");
|
|
6
|
-
const dev_1 = require("./dev");
|
|
7
|
-
const module_1 = require("./module");
|
|
8
|
-
function resolveOptions(config) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10
|
-
const context = (_a = config.context) !== null && _a !== void 0 ? _a : process.cwd();
|
|
11
|
-
const mode = (_b = config.mode) !== null && _b !== void 0 ? _b : "development";
|
|
12
|
-
const dev = (0, dev_1.resolveDevOptions)(config.dev, { context });
|
|
13
|
-
const entry = (_c = config.entry) !== null && _c !== void 0 ? _c : {};
|
|
14
|
-
const output = (0, output_1.resolveOutputOptions)(config.output);
|
|
15
|
-
const define = (_d = config.define) !== null && _d !== void 0 ? _d : {};
|
|
16
|
-
const target = (0, target_1.resolveTargetOptions)(config.target);
|
|
17
|
-
const external = (_e = config.external) !== null && _e !== void 0 ? _e : {};
|
|
18
|
-
const plugins = (_f = config.plugins) !== null && _f !== void 0 ? _f : [];
|
|
19
|
-
const builtins = (_g = config.builtins) !== null && _g !== void 0 ? _g : [];
|
|
20
|
-
const resolve = (_h = config.resolve) !== null && _h !== void 0 ? _h : {};
|
|
21
|
-
const module = (0, module_1.resolveModuleOptions)(config.module);
|
|
22
|
-
return {
|
|
23
|
-
context,
|
|
24
|
-
mode,
|
|
25
|
-
dev,
|
|
26
|
-
entry,
|
|
27
|
-
output,
|
|
28
|
-
define,
|
|
29
|
-
target,
|
|
30
|
-
external,
|
|
31
|
-
plugins,
|
|
32
|
-
builtins,
|
|
33
|
-
module,
|
|
34
|
-
resolve
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
exports.resolveOptions = resolveOptions;
|
package/lib/config/output.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveOutputOptions = void 0;
|
|
4
|
-
function resolveOutputOptions(output = {}) {
|
|
5
|
-
return {
|
|
6
|
-
path: output.path,
|
|
7
|
-
publicPath: output.publicPath,
|
|
8
|
-
chunkFilename: output.chunkFilename,
|
|
9
|
-
filename: output.publicPath,
|
|
10
|
-
assetModuleFilename: output.assetModuleFilename,
|
|
11
|
-
uniqueName: output.uniqueName
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
exports.resolveOutputOptions = resolveOutputOptions;
|
package/lib/config/plugin.d.ts
DELETED
package/lib/config/resolve.d.ts
DELETED
package/lib/config/resolve.js
DELETED
package/lib/config/target.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare type TargetItem = "web" | "webworker" | "browserslist" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022";
|
|
2
|
-
export declare type Target = TargetItem | TargetItem[] | false;
|
|
3
|
-
export declare type ResolvedTarget = TargetItem[];
|
|
4
|
-
export declare function resolveTargetOptions(target?: Target): ResolvedTarget;
|
|
5
|
-
export {};
|
package/lib/config/target.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveTargetOptions = void 0;
|
|
4
|
-
function resolveTargetOptions(target = "web") {
|
|
5
|
-
if (!target) {
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
8
|
-
if (!Array.isArray(target)) {
|
|
9
|
-
return [target];
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
}
|
|
13
|
-
exports.resolveTargetOptions = resolveTargetOptions;
|
package/lib/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export * from "./build";
|
|
2
|
-
import * as binding from "@rspack/binding";
|
|
3
|
-
import * as tapable from "tapable";
|
|
4
|
-
import { RspackOptions, ResolvedRspackOptions, Asset } from "./config";
|
|
5
|
-
import { Source } from "webpack-sources";
|
|
6
|
-
declare class RspackCompilation {
|
|
7
|
-
#private;
|
|
8
|
-
hooks: {
|
|
9
|
-
processAssets: tapable.AsyncSeriesHook<Record<string, Source>>;
|
|
10
|
-
};
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* unsafe to call out of processAssets
|
|
14
|
-
* @param filename
|
|
15
|
-
* @param asset
|
|
16
|
-
*/
|
|
17
|
-
updateAsset(filename: string, asset: Asset): void;
|
|
18
|
-
/**
|
|
19
|
-
* unsafe to call out of processAssets
|
|
20
|
-
* @param filename
|
|
21
|
-
* @param asset
|
|
22
|
-
*/
|
|
23
|
-
emitAsset(filename: string, asset: Asset): void;
|
|
24
|
-
processAssets(err: Error, value: string, emitAsset: any): Promise<string>;
|
|
25
|
-
}
|
|
26
|
-
declare class Rspack {
|
|
27
|
-
#private;
|
|
28
|
-
compilation: RspackCompilation;
|
|
29
|
-
hooks: {
|
|
30
|
-
done: tapable.AsyncSeriesHook<void>;
|
|
31
|
-
compilation: tapable.SyncHook<RspackCompilation>;
|
|
32
|
-
};
|
|
33
|
-
options: ResolvedRspackOptions;
|
|
34
|
-
constructor(options: RspackOptions);
|
|
35
|
-
build(): Promise<binding.Stats>;
|
|
36
|
-
rebuild(changeFiles: string[]): Promise<Record<string, string>>;
|
|
37
|
-
}
|
|
38
|
-
export { Rspack };
|
|
39
|
-
export default Rspack;
|
package/lib/index.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
29
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
30
|
-
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");
|
|
31
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
32
|
-
};
|
|
33
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
34
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
35
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
36
|
-
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");
|
|
37
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
38
|
-
};
|
|
39
|
-
var _RspackCompilation_emitAssetCallback, _Rspack_instances, _Rspack_plugins, _Rspack_instance, _Rspack_done, _Rspack_processAssets, _Rspack_newCompilation;
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.Rspack = void 0;
|
|
42
|
-
__exportStar(require("./build"), exports);
|
|
43
|
-
const binding = __importStar(require("@rspack/binding"));
|
|
44
|
-
const tapable = __importStar(require("tapable"));
|
|
45
|
-
const config_1 = require("./config");
|
|
46
|
-
const webpack_sources_1 = require("webpack-sources");
|
|
47
|
-
const createDummyResult = (id) => {
|
|
48
|
-
const result = {
|
|
49
|
-
id,
|
|
50
|
-
inner: null
|
|
51
|
-
};
|
|
52
|
-
return JSON.stringify(result);
|
|
53
|
-
};
|
|
54
|
-
class RspackCompilation {
|
|
55
|
-
constructor() {
|
|
56
|
-
_RspackCompilation_emitAssetCallback.set(this, void 0);
|
|
57
|
-
this.hooks = {
|
|
58
|
-
processAssets: new tapable.AsyncSeriesHook([
|
|
59
|
-
"assets"
|
|
60
|
-
])
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* unsafe to call out of processAssets
|
|
65
|
-
* @param filename
|
|
66
|
-
* @param asset
|
|
67
|
-
*/
|
|
68
|
-
updateAsset(filename, asset) {
|
|
69
|
-
this.emitAsset(filename, asset);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* unsafe to call out of processAssets
|
|
73
|
-
* @param filename
|
|
74
|
-
* @param asset
|
|
75
|
-
*/
|
|
76
|
-
emitAsset(filename, asset) {
|
|
77
|
-
if (!__classPrivateFieldGet(this, _RspackCompilation_emitAssetCallback, "f")) {
|
|
78
|
-
throw new Error("can't call emitAsset outof processAssets hook for now");
|
|
79
|
-
}
|
|
80
|
-
__classPrivateFieldGet(this, _RspackCompilation_emitAssetCallback, "f").call(this, {
|
|
81
|
-
filename: filename,
|
|
82
|
-
asset
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async processAssets(err, value, emitAsset) {
|
|
86
|
-
var _a;
|
|
87
|
-
__classPrivateFieldSet(this, _RspackCompilation_emitAssetCallback, emitAsset, "f");
|
|
88
|
-
if (err) {
|
|
89
|
-
throw err;
|
|
90
|
-
}
|
|
91
|
-
const context = JSON.parse(value);
|
|
92
|
-
let content = (_a = context.inner) !== null && _a !== void 0 ? _a : {};
|
|
93
|
-
let assets = {};
|
|
94
|
-
for (const [key, value] of Object.entries(content)) {
|
|
95
|
-
// webpack-sources's type definition is wrong, it actually could accept Buffer type
|
|
96
|
-
let source = value.source;
|
|
97
|
-
if (Array.isArray(value.source)) {
|
|
98
|
-
source = Buffer.from(value.source);
|
|
99
|
-
}
|
|
100
|
-
assets[key] = new webpack_sources_1.RawSource(source);
|
|
101
|
-
}
|
|
102
|
-
await this.hooks.processAssets.promise(assets);
|
|
103
|
-
return createDummyResult(context.id);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
_RspackCompilation_emitAssetCallback = new WeakMap();
|
|
107
|
-
class Rspack {
|
|
108
|
-
constructor(options) {
|
|
109
|
-
var _a;
|
|
110
|
-
_Rspack_instances.add(this);
|
|
111
|
-
_Rspack_plugins.set(this, void 0);
|
|
112
|
-
_Rspack_instance.set(this, void 0);
|
|
113
|
-
this.options = (0, config_1.resolveOptions)(options);
|
|
114
|
-
// @ts-ignored
|
|
115
|
-
__classPrivateFieldSet(this, _Rspack_instance, binding.newRspack(this.options, {
|
|
116
|
-
doneCallback: __classPrivateFieldGet(this, _Rspack_instances, "m", _Rspack_done).bind(this),
|
|
117
|
-
processAssetsCallback: __classPrivateFieldGet(this, _Rspack_instances, "m", _Rspack_processAssets).bind(this)
|
|
118
|
-
}), "f");
|
|
119
|
-
this.hooks = {
|
|
120
|
-
done: new tapable.AsyncSeriesHook(),
|
|
121
|
-
compilation: new tapable.SyncHook(["compilation"])
|
|
122
|
-
};
|
|
123
|
-
__classPrivateFieldSet(this, _Rspack_plugins, (_a = options.plugins) !== null && _a !== void 0 ? _a : [], "f");
|
|
124
|
-
for (const plugin of __classPrivateFieldGet(this, _Rspack_plugins, "f")) {
|
|
125
|
-
plugin.apply(this);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async build() {
|
|
129
|
-
const compilation = __classPrivateFieldGet(this, _Rspack_instances, "m", _Rspack_newCompilation).call(this);
|
|
130
|
-
const stats = await binding.build(__classPrivateFieldGet(this, _Rspack_instance, "f"));
|
|
131
|
-
return stats;
|
|
132
|
-
}
|
|
133
|
-
async rebuild(changeFiles) {
|
|
134
|
-
const stats = await binding.rebuild(__classPrivateFieldGet(this, _Rspack_instance, "f"), changeFiles);
|
|
135
|
-
return stats;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.Rspack = Rspack;
|
|
139
|
-
_Rspack_plugins = new WeakMap(), _Rspack_instance = new WeakMap(), _Rspack_instances = new WeakSet(), _Rspack_done = async function _Rspack_done(err, value) {
|
|
140
|
-
if (err) {
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
const context = JSON.parse(value);
|
|
144
|
-
await this.hooks.done.promise();
|
|
145
|
-
return createDummyResult(context.id);
|
|
146
|
-
}, _Rspack_processAssets = async function _Rspack_processAssets(err, value, emitAsset) {
|
|
147
|
-
return this.compilation.processAssets(err, value, emitAsset);
|
|
148
|
-
}, _Rspack_newCompilation = function _Rspack_newCompilation() {
|
|
149
|
-
const compilation = new RspackCompilation();
|
|
150
|
-
this.compilation = compilation;
|
|
151
|
-
this.hooks.compilation.call(compilation);
|
|
152
|
-
return compilation;
|
|
153
|
-
};
|
|
154
|
-
exports.default = Rspack;
|
package/lib/server/index.d.ts
DELETED
|
File without changes
|
package/lib/server/index.js
DELETED
|
File without changes
|
package/src/bin/index.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { createServer } from "@rspack/dev-server";
|
|
3
|
-
import { Rspack } from "..";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
import { build } from "../build";
|
|
6
|
-
|
|
7
|
-
const program = new Command();
|
|
8
|
-
|
|
9
|
-
program
|
|
10
|
-
.option("--env", "env")
|
|
11
|
-
.command("build", {
|
|
12
|
-
isDefault: true
|
|
13
|
-
})
|
|
14
|
-
.description("Rspack build cli")
|
|
15
|
-
|
|
16
|
-
.argument("<config-file>", "rspack config file path")
|
|
17
|
-
.action(async configPath => {
|
|
18
|
-
const config = require(configPath);
|
|
19
|
-
const stats = await build(config);
|
|
20
|
-
console.log(stats);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
program
|
|
24
|
-
.command("dev")
|
|
25
|
-
.description("Rspack build cli")
|
|
26
|
-
.argument("<config-file>", "rspack config file path")
|
|
27
|
-
.action(async configPath => {
|
|
28
|
-
const config = require(configPath);
|
|
29
|
-
const rspack = new Rspack(config);
|
|
30
|
-
const { options: { dev: { port = 8080 } = {} } = {} } = rspack;
|
|
31
|
-
await rspack.build();
|
|
32
|
-
const server = await createServer(rspack.options);
|
|
33
|
-
server.listen(port, () => console.log(`Server listening on port: ${port}`));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
program.parse();
|
package/src/build.ts
DELETED
package/src/config/builtins.ts
DELETED
package/src/config/context.ts
DELETED
package/src/config/define.ts
DELETED