@rspack/core 0.0.3 → 0.0.7
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/CHANGELOG.md +30 -0
- package/example/basic.ts +29 -1
- package/{dist → lib}/bin/index.d.ts +0 -0
- package/{dist → lib}/bin/index.js +0 -0
- package/{dist → lib}/build.d.ts +0 -0
- package/{dist → lib}/build.js +0 -0
- package/lib/config/builtins.d.ts +3 -0
- package/lib/config/builtins.js +2 -0
- package/lib/config/context.d.ts +2 -0
- package/lib/config/context.js +2 -0
- package/lib/config/define.d.ts +2 -0
- package/lib/config/define.js +2 -0
- package/lib/config/dev.d.ts +17 -0
- package/lib/config/dev.js +17 -0
- package/lib/config/entry.d.ts +2 -0
- package/lib/config/entry.js +2 -0
- package/lib/config/external.d.ts +2 -0
- package/lib/config/external.js +2 -0
- package/lib/config/index.d.ts +45 -0
- package/lib/config/index.js +37 -0
- package/lib/config/mode.d.ts +2 -0
- package/lib/config/mode.js +2 -0
- package/{dist/index.d.ts → lib/config/module.d.ts} +41 -29
- package/lib/config/module.js +121 -0
- package/lib/config/output.d.ts +17 -0
- package/lib/config/output.js +14 -0
- package/lib/config/plugin.d.ts +5 -0
- package/lib/config/plugin.js +2 -0
- package/lib/config/resolve.d.ts +6 -0
- package/lib/config/resolve.js +2 -0
- package/lib/config/target.d.ts +5 -0
- package/lib/config/target.js +13 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.js +154 -0
- package/{dist → lib}/server/index.d.ts +0 -0
- package/{dist → lib}/server/index.js +0 -0
- package/package.json +26 -11
- package/src/config/builtins.ts +5 -0
- package/src/config/context.ts +3 -0
- package/src/config/define.ts +3 -0
- package/src/config/dev.ts +32 -0
- package/src/config/entry.ts +3 -0
- package/src/config/external.ts +3 -0
- package/src/config/index.ts +80 -0
- package/src/config/mode.ts +2 -0
- package/src/config/module.ts +240 -0
- package/src/config/output.ts +29 -0
- package/src/config/plugin.ts +6 -0
- package/src/config/resolve.ts +6 -0
- package/src/config/target.ts +28 -0
- package/src/index.ts +107 -219
- package/tests/config.test.ts +40 -0
- package/tsconfig.json +6 -5
- package/dist/config.d.ts +0 -43
- package/dist/config.js +0 -25
- package/dist/index.js +0 -184
- package/src/config.ts +0 -66
package/src/config.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { RawOptions } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
import type { ModuleRule } from ".";
|
|
4
|
-
import { createRawModuleRuleUses } from ".";
|
|
5
|
-
|
|
6
|
-
export type Plugin = {
|
|
7
|
-
name: string;
|
|
8
|
-
done?: () => void | Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export interface RspackOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Entry points of compilation.
|
|
14
|
-
*/
|
|
15
|
-
entry?: RawOptions["entry"];
|
|
16
|
-
/**
|
|
17
|
-
* An **absolute** path pointed the
|
|
18
|
-
*/
|
|
19
|
-
context?: RawOptions["context"];
|
|
20
|
-
/**
|
|
21
|
-
* An array of plugins
|
|
22
|
-
*/
|
|
23
|
-
plugins?: Plugin[];
|
|
24
|
-
/**
|
|
25
|
-
* dev server
|
|
26
|
-
*/
|
|
27
|
-
dev?: {
|
|
28
|
-
port?: Number;
|
|
29
|
-
static?: {
|
|
30
|
-
directory?: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Module configuration.
|
|
35
|
-
*/
|
|
36
|
-
module?: {
|
|
37
|
-
rules?: ModuleRule[];
|
|
38
|
-
parser?: RawOptions["module"]["parser"];
|
|
39
|
-
};
|
|
40
|
-
define?: RawOptions["define"];
|
|
41
|
-
target?: RawOptions["target"];
|
|
42
|
-
mode?: RawOptions["mode"];
|
|
43
|
-
external?: RawOptions["external"];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function User2Native(config: RspackOptions): RawOptions & {
|
|
47
|
-
plugins: Plugin[];
|
|
48
|
-
} {
|
|
49
|
-
return {
|
|
50
|
-
entry: config.entry ?? {},
|
|
51
|
-
context: config.context,
|
|
52
|
-
define: config.define,
|
|
53
|
-
target: config.target,
|
|
54
|
-
external: config.external,
|
|
55
|
-
plugins: config.plugins ?? [],
|
|
56
|
-
module: {
|
|
57
|
-
// TODO: support mutliple rules to support `Module Type`
|
|
58
|
-
rules: (config?.module?.rules ?? []).map(rule => {
|
|
59
|
-
return {
|
|
60
|
-
...rule,
|
|
61
|
-
uses: createRawModuleRuleUses(rule.uses || [])
|
|
62
|
-
};
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|