@workleap/swc-configs 1.0.0 → 1.0.1
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 +7 -1
- package/README.md +1 -1
- package/dist/applyTransformers.d.ts +9 -0
- package/dist/applyTransformers.js +8 -0
- package/dist/applyTransformers.mjs +1 -0
- package/dist/build.d.ts +6 -30
- package/dist/build.js +51 -62
- package/dist/build.mjs +2 -3
- package/dist/chunk-3UBBOKDF.mjs +6 -0
- package/dist/chunk-6PUKUTDM.mjs +45 -0
- package/dist/chunk-LPGVRYUE.mjs +55 -0
- package/dist/chunk-UFEY2RGG.mjs +56 -0
- package/dist/dev.d.ts +6 -27
- package/dist/dev.js +50 -63
- package/dist/dev.mjs +2 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +135 -146
- package/dist/index.mjs +4 -5
- package/dist/jest.d.ts +5 -19
- package/dist/jest.js +40 -61
- package/dist/jest.mjs +2 -3
- package/package.json +7 -6
- package/dist/chunk-4LXCYXR5.mjs +0 -18
- package/dist/chunk-4XYHUSOR.mjs +0 -51
- package/dist/chunk-5HQ4FWBC.mjs +0 -49
- package/dist/chunk-JW562DWU.mjs +0 -50
- package/dist/chunk-XCGQZSNA.mjs +0 -6
- package/dist/cloneObjectExceptFunctions.d.ts +0 -3
- package/dist/cloneObjectExceptFunctions.js +0 -8
- package/dist/cloneObjectExceptFunctions.mjs +0 -1
- package/dist/resolveOverrides.d.ts +0 -7
- package/dist/resolveOverrides.js +0 -20
- package/dist/resolveOverrides.mjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,168 +1,157 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
function
|
|
5
|
-
return
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/resolveOverrides.ts
|
|
9
|
-
function resolveOverrides(config, configOverride) {
|
|
10
|
-
if (typeof configOverride === "function") {
|
|
11
|
-
return {
|
|
12
|
-
...config,
|
|
13
|
-
...configOverride(config)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (configOverride) {
|
|
17
|
-
return {
|
|
18
|
-
...config,
|
|
19
|
-
...configOverride
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return config;
|
|
3
|
+
// src/applyTransformers.ts
|
|
4
|
+
function applyTransformers(config, transformers, context) {
|
|
5
|
+
return transformers.reduce((acc, transformer) => transformer(acc, context), config);
|
|
23
6
|
}
|
|
24
7
|
|
|
25
8
|
// src/build.ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
function defineBuildConfig(options) {
|
|
10
|
+
const {
|
|
11
|
+
browsers,
|
|
12
|
+
parser = "typescript",
|
|
13
|
+
transformers = []
|
|
14
|
+
} = options;
|
|
15
|
+
const config = {
|
|
16
|
+
jsc: {
|
|
17
|
+
parser: parser === "ecmascript" ? {
|
|
18
|
+
syntax: "ecmascript",
|
|
19
|
+
jsx: true
|
|
20
|
+
} : {
|
|
21
|
+
syntax: "typescript",
|
|
22
|
+
tsx: true
|
|
23
|
+
},
|
|
24
|
+
// The output environment that the code will be compiled for.
|
|
25
|
+
target: "es2022",
|
|
26
|
+
// View https://swc.rs/docs/configuration/minification for options.
|
|
27
|
+
minify: {
|
|
28
|
+
compress: true,
|
|
29
|
+
mangle: true
|
|
30
|
+
},
|
|
31
|
+
transform: {
|
|
32
|
+
react: {
|
|
33
|
+
// Use "react/jsx-runtime".
|
|
34
|
+
runtime: "automatic",
|
|
35
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
36
|
+
useBuiltins: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
40
|
+
// Requires to add "@swc/helpers" as a project dependency.
|
|
41
|
+
externalHelpers: true
|
|
38
42
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
module: {
|
|
44
|
+
// The output module resolution system that the code will be compiled for.
|
|
45
|
+
type: "es6",
|
|
46
|
+
// Prevent SWC from exporting the `__esModule` property.
|
|
47
|
+
strict: true,
|
|
48
|
+
// Preserve dynamic imports.
|
|
49
|
+
ignoreDynamic: true
|
|
46
50
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
strict: true,
|
|
56
|
-
// Preserve dynamic imports.
|
|
57
|
-
ignoreDynamic: true
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
function defineBuildConfig({ parser, configOverride } = {}) {
|
|
61
|
-
const config = cloneObjectExceptFunctions(DefaultBuildConfig);
|
|
62
|
-
if (parser === "ecmascript") {
|
|
63
|
-
config.jsc.parser = {
|
|
64
|
-
syntax: "ecmascript",
|
|
65
|
-
jsx: true
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return resolveOverrides(config, configOverride);
|
|
51
|
+
env: {
|
|
52
|
+
targets: browsers
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
56
|
+
environment: "build"
|
|
57
|
+
});
|
|
58
|
+
return transformedConfig;
|
|
69
59
|
}
|
|
70
60
|
|
|
71
61
|
// src/dev.ts
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
function defineDevConfig(options) {
|
|
63
|
+
const {
|
|
64
|
+
browsers,
|
|
65
|
+
fastRefresh = false,
|
|
66
|
+
parser = "typescript",
|
|
67
|
+
transformers = []
|
|
68
|
+
} = options;
|
|
69
|
+
const config = {
|
|
70
|
+
jsc: {
|
|
71
|
+
parser: parser === "ecmascript" ? {
|
|
72
|
+
syntax: "ecmascript",
|
|
73
|
+
jsx: true
|
|
74
|
+
} : {
|
|
75
|
+
syntax: "typescript",
|
|
76
|
+
tsx: true
|
|
77
|
+
},
|
|
78
|
+
// The output environment that the code will be compiled for.
|
|
79
|
+
target: "es2022",
|
|
80
|
+
transform: {
|
|
81
|
+
react: {
|
|
82
|
+
// Use "react/jsx-runtime".
|
|
83
|
+
runtime: "automatic",
|
|
84
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
85
|
+
useBuiltins: true,
|
|
86
|
+
// Enable React experimental "fast-refresh" feature.
|
|
87
|
+
// Also need to install @pmmmwh/react-refresh-webpack-plugin.
|
|
88
|
+
refresh: fastRefresh
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
92
|
+
// Requires to add "@swc/helpers" as a project dependency.
|
|
93
|
+
externalHelpers: true
|
|
77
94
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
useBuiltins: true,
|
|
86
|
-
// Enable React experimental "fast-refresh" feature.
|
|
87
|
-
// Also need to install @pmmmwh/react-refresh-webpack-plugin.
|
|
88
|
-
refresh: false
|
|
89
|
-
}
|
|
95
|
+
module: {
|
|
96
|
+
// The output module resolution system that the code will be compiled for.
|
|
97
|
+
type: "es6",
|
|
98
|
+
// Prevent SWC from exporting the `__esModule` property.
|
|
99
|
+
strict: true,
|
|
100
|
+
// Preserve dynamic imports.
|
|
101
|
+
ignoreDynamic: true
|
|
90
102
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
strict: true,
|
|
100
|
-
// Preserve dynamic imports.
|
|
101
|
-
ignoreDynamic: true
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
function defineDevConfig({ fastRefresh, parser, configOverride } = {}) {
|
|
105
|
-
const config = cloneObjectExceptFunctions(DefaultDevConfig);
|
|
106
|
-
if (fastRefresh) {
|
|
107
|
-
config.jsc.transform.react.refresh = true;
|
|
108
|
-
}
|
|
109
|
-
if (parser === "ecmascript") {
|
|
110
|
-
config.jsc.parser = {
|
|
111
|
-
syntax: "ecmascript",
|
|
112
|
-
jsx: true
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return resolveOverrides(config, configOverride);
|
|
103
|
+
env: {
|
|
104
|
+
targets: browsers
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
108
|
+
environment: "dev"
|
|
109
|
+
});
|
|
110
|
+
return transformedConfig;
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
// src/jest.ts
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
function defineJestConfig(options = {}) {
|
|
115
|
+
const {
|
|
116
|
+
react = false,
|
|
117
|
+
parser = "typescript",
|
|
118
|
+
transformers = []
|
|
119
|
+
} = options;
|
|
120
|
+
const config = {
|
|
121
|
+
jsc: {
|
|
122
|
+
parser: parser === "ecmascript" ? {
|
|
123
|
+
syntax: "ecmascript",
|
|
124
|
+
jsx: react
|
|
125
|
+
} : {
|
|
126
|
+
syntax: "typescript",
|
|
127
|
+
tsx: react
|
|
128
|
+
},
|
|
129
|
+
// The output environment that the code will be compiled for.
|
|
130
|
+
target: "es2022",
|
|
131
|
+
transform: react ? {
|
|
132
|
+
react: {
|
|
133
|
+
// Use "react/jsx-runtime".
|
|
134
|
+
runtime: "automatic",
|
|
135
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
136
|
+
useBuiltins: true
|
|
137
|
+
}
|
|
138
|
+
} : void 0
|
|
123
139
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// The output module resolution system that the code will be compiled for.
|
|
132
|
-
type: "es6",
|
|
133
|
-
// Prevent SWC from exporting the `__esModule` property.
|
|
134
|
-
strict: true,
|
|
135
|
-
// Preserve dynamic imports.
|
|
136
|
-
ignoreDynamic: true
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
function defineJestConfig({ react, parser, configOverride } = {}) {
|
|
140
|
-
const config = cloneObjectExceptFunctions(DefaultJestConfig);
|
|
141
|
-
if (react) {
|
|
142
|
-
config.jsc.transform = {
|
|
143
|
-
react: {
|
|
144
|
-
// Use "react/jsx-runtime".
|
|
145
|
-
runtime: "automatic",
|
|
146
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
147
|
-
useBuiltins: true
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (parser === "ecmascript") {
|
|
152
|
-
const parserConfig = { syntax: "ecmascript" };
|
|
153
|
-
if (react) {
|
|
154
|
-
parserConfig.jsx = true;
|
|
140
|
+
module: {
|
|
141
|
+
// The output module resolution system that the code will be compiled for.
|
|
142
|
+
type: "es6",
|
|
143
|
+
// Prevent SWC from exporting the `__esModule` property.
|
|
144
|
+
strict: true,
|
|
145
|
+
// Preserve dynamic imports.
|
|
146
|
+
ignoreDynamic: true
|
|
155
147
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
return
|
|
148
|
+
};
|
|
149
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
150
|
+
environment: "jest"
|
|
151
|
+
});
|
|
152
|
+
return transformedConfig;
|
|
161
153
|
}
|
|
162
154
|
|
|
163
|
-
exports.DefaultBuildConfig = DefaultBuildConfig;
|
|
164
|
-
exports.DefaultDevConfig = DefaultDevConfig;
|
|
165
|
-
exports.DefaultJestConfig = DefaultJestConfig;
|
|
166
155
|
exports.defineBuildConfig = defineBuildConfig;
|
|
167
156
|
exports.defineDevConfig = defineDevConfig;
|
|
168
157
|
exports.defineJestConfig = defineJestConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-4LXCYXR5.mjs';
|
|
1
|
+
export { defineBuildConfig } from './chunk-UFEY2RGG.mjs';
|
|
2
|
+
export { defineDevConfig } from './chunk-LPGVRYUE.mjs';
|
|
3
|
+
export { defineJestConfig } from './chunk-6PUKUTDM.mjs';
|
|
4
|
+
import './chunk-3UBBOKDF.mjs';
|
package/dist/jest.d.ts
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { Config } from '@swc/core';
|
|
2
|
-
import {
|
|
2
|
+
import { SwcConfigTransformer } from './applyTransformers.js';
|
|
3
3
|
|
|
4
|
-
declare const DefaultJestConfig: {
|
|
5
|
-
jsc: {
|
|
6
|
-
parser: {
|
|
7
|
-
syntax: "typescript";
|
|
8
|
-
};
|
|
9
|
-
target: "es2022";
|
|
10
|
-
externalHelpers: true;
|
|
11
|
-
};
|
|
12
|
-
module: {
|
|
13
|
-
type: "es6";
|
|
14
|
-
strict: true;
|
|
15
|
-
ignoreDynamic: true;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
4
|
interface DefineJestConfigOptions {
|
|
19
5
|
react?: boolean;
|
|
20
|
-
parser?: "ecmascript";
|
|
21
|
-
|
|
6
|
+
parser?: "ecmascript" | "typescript";
|
|
7
|
+
transformers?: SwcConfigTransformer[];
|
|
22
8
|
}
|
|
23
|
-
declare function defineJestConfig(
|
|
9
|
+
declare function defineJestConfig(options?: DefineJestConfigOptions): Config;
|
|
24
10
|
|
|
25
|
-
export {
|
|
11
|
+
export { DefineJestConfigOptions, defineJestConfig };
|
package/dist/jest.js
CHANGED
|
@@ -1,71 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
function
|
|
5
|
-
return
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// src/resolveOverrides.ts
|
|
9
|
-
function resolveOverrides(config, configOverride) {
|
|
10
|
-
if (typeof configOverride === "function") {
|
|
11
|
-
return {
|
|
12
|
-
...config,
|
|
13
|
-
...configOverride(config)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
if (configOverride) {
|
|
17
|
-
return {
|
|
18
|
-
...config,
|
|
19
|
-
...configOverride
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return config;
|
|
3
|
+
// src/applyTransformers.ts
|
|
4
|
+
function applyTransformers(config, transformers, context) {
|
|
5
|
+
return transformers.reduce((acc, transformer) => transformer(acc, context), config);
|
|
23
6
|
}
|
|
24
7
|
|
|
25
8
|
// src/jest.ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
function defineJestConfig(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
react = false,
|
|
12
|
+
parser = "typescript",
|
|
13
|
+
transformers = []
|
|
14
|
+
} = options;
|
|
15
|
+
const config = {
|
|
16
|
+
jsc: {
|
|
17
|
+
parser: parser === "ecmascript" ? {
|
|
18
|
+
syntax: "ecmascript",
|
|
19
|
+
jsx: react
|
|
20
|
+
} : {
|
|
21
|
+
syntax: "typescript",
|
|
22
|
+
tsx: react
|
|
23
|
+
},
|
|
24
|
+
// The output environment that the code will be compiled for.
|
|
25
|
+
target: "es2022",
|
|
26
|
+
transform: react ? {
|
|
27
|
+
react: {
|
|
28
|
+
// Use "react/jsx-runtime".
|
|
29
|
+
runtime: "automatic",
|
|
30
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
31
|
+
useBuiltins: true
|
|
32
|
+
}
|
|
33
|
+
} : void 0
|
|
30
34
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// The output module resolution system that the code will be compiled for.
|
|
39
|
-
type: "es6",
|
|
40
|
-
// Prevent SWC from exporting the `__esModule` property.
|
|
41
|
-
strict: true,
|
|
42
|
-
// Preserve dynamic imports.
|
|
43
|
-
ignoreDynamic: true
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
function defineJestConfig({ react, parser, configOverride } = {}) {
|
|
47
|
-
const config = cloneObjectExceptFunctions(DefaultJestConfig);
|
|
48
|
-
if (react) {
|
|
49
|
-
config.jsc.transform = {
|
|
50
|
-
react: {
|
|
51
|
-
// Use "react/jsx-runtime".
|
|
52
|
-
runtime: "automatic",
|
|
53
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
54
|
-
useBuiltins: true
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
if (parser === "ecmascript") {
|
|
59
|
-
const parserConfig = { syntax: "ecmascript" };
|
|
60
|
-
if (react) {
|
|
61
|
-
parserConfig.jsx = true;
|
|
35
|
+
module: {
|
|
36
|
+
// The output module resolution system that the code will be compiled for.
|
|
37
|
+
type: "es6",
|
|
38
|
+
// Prevent SWC from exporting the `__esModule` property.
|
|
39
|
+
strict: true,
|
|
40
|
+
// Preserve dynamic imports.
|
|
41
|
+
ignoreDynamic: true
|
|
62
42
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
return
|
|
43
|
+
};
|
|
44
|
+
const transformedConfig = applyTransformers(config, transformers, {
|
|
45
|
+
environment: "jest"
|
|
46
|
+
});
|
|
47
|
+
return transformedConfig;
|
|
68
48
|
}
|
|
69
49
|
|
|
70
|
-
exports.DefaultJestConfig = DefaultJestConfig;
|
|
71
50
|
exports.defineJestConfig = defineJestConfig;
|
package/dist/jest.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-4LXCYXR5.mjs';
|
|
1
|
+
export { defineJestConfig } from './chunk-6PUKUTDM.mjs';
|
|
2
|
+
import './chunk-3UBBOKDF.mjs';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workleap/swc-configs",
|
|
3
3
|
"description": "Workleap recommended SWC configs.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"workleap",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"import": "./dist/index.mjs",
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.mjs"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
],
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/
|
|
26
|
+
"url": "git+https://github.com/gsoft-inc/wl-web-configs.git",
|
|
26
27
|
"directory": "packages/swc-configs"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
@@ -34,9 +35,9 @@
|
|
|
34
35
|
"ts-node": "10.9.1",
|
|
35
36
|
"tsup": "6.7.0",
|
|
36
37
|
"typescript": "5.0.4",
|
|
37
|
-
"@workleap/eslint-plugin": "1.8.
|
|
38
|
-
"@workleap/tsup-configs": "2.0.
|
|
39
|
-
"@workleap/typescript-configs": "2.3.
|
|
38
|
+
"@workleap/eslint-plugin": "1.8.3",
|
|
39
|
+
"@workleap/tsup-configs": "2.0.1",
|
|
40
|
+
"@workleap/typescript-configs": "2.3.3"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"@swc/core": "*",
|
package/dist/chunk-4LXCYXR5.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/resolveOverrides.ts
|
|
2
|
-
function resolveOverrides(config, configOverride) {
|
|
3
|
-
if (typeof configOverride === "function") {
|
|
4
|
-
return {
|
|
5
|
-
...config,
|
|
6
|
-
...configOverride(config)
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (configOverride) {
|
|
10
|
-
return {
|
|
11
|
-
...config,
|
|
12
|
-
...configOverride
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return config;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { resolveOverrides };
|
package/dist/chunk-4XYHUSOR.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { cloneObjectExceptFunctions } from './chunk-XCGQZSNA.mjs';
|
|
2
|
-
import { resolveOverrides } from './chunk-4LXCYXR5.mjs';
|
|
3
|
-
|
|
4
|
-
// src/dev.ts
|
|
5
|
-
var DefaultDevConfig = {
|
|
6
|
-
jsc: {
|
|
7
|
-
parser: {
|
|
8
|
-
syntax: "typescript",
|
|
9
|
-
tsx: true
|
|
10
|
-
},
|
|
11
|
-
// The output environment that the code will be compiled for.
|
|
12
|
-
target: "es2022",
|
|
13
|
-
transform: {
|
|
14
|
-
react: {
|
|
15
|
-
// Use "react/jsx-runtime".
|
|
16
|
-
runtime: "automatic",
|
|
17
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
18
|
-
useBuiltins: true,
|
|
19
|
-
// Enable React experimental "fast-refresh" feature.
|
|
20
|
-
// Also need to install @pmmmwh/react-refresh-webpack-plugin.
|
|
21
|
-
refresh: false
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
25
|
-
// Requires to add "@swc/helpers" as a project dependency
|
|
26
|
-
externalHelpers: true
|
|
27
|
-
},
|
|
28
|
-
module: {
|
|
29
|
-
// The output module resolution system that the code will be compiled for.
|
|
30
|
-
type: "es6",
|
|
31
|
-
// Prevent SWC from exporting the `__esModule` property.
|
|
32
|
-
strict: true,
|
|
33
|
-
// Preserve dynamic imports.
|
|
34
|
-
ignoreDynamic: true
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function defineDevConfig({ fastRefresh, parser, configOverride } = {}) {
|
|
38
|
-
const config = cloneObjectExceptFunctions(DefaultDevConfig);
|
|
39
|
-
if (fastRefresh) {
|
|
40
|
-
config.jsc.transform.react.refresh = true;
|
|
41
|
-
}
|
|
42
|
-
if (parser === "ecmascript") {
|
|
43
|
-
config.jsc.parser = {
|
|
44
|
-
syntax: "ecmascript",
|
|
45
|
-
jsx: true
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return resolveOverrides(config, configOverride);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { DefaultDevConfig, defineDevConfig };
|
package/dist/chunk-5HQ4FWBC.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { cloneObjectExceptFunctions } from './chunk-XCGQZSNA.mjs';
|
|
2
|
-
import { resolveOverrides } from './chunk-4LXCYXR5.mjs';
|
|
3
|
-
|
|
4
|
-
// src/jest.ts
|
|
5
|
-
var DefaultJestConfig = {
|
|
6
|
-
jsc: {
|
|
7
|
-
parser: {
|
|
8
|
-
syntax: "typescript"
|
|
9
|
-
},
|
|
10
|
-
// The output environment that the code will be compiled for.
|
|
11
|
-
target: "es2022",
|
|
12
|
-
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
13
|
-
// Requires to add "@swc/helpers" as a project dependency
|
|
14
|
-
externalHelpers: true
|
|
15
|
-
},
|
|
16
|
-
module: {
|
|
17
|
-
// The output module resolution system that the code will be compiled for.
|
|
18
|
-
type: "es6",
|
|
19
|
-
// Prevent SWC from exporting the `__esModule` property.
|
|
20
|
-
strict: true,
|
|
21
|
-
// Preserve dynamic imports.
|
|
22
|
-
ignoreDynamic: true
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
function defineJestConfig({ react, parser, configOverride } = {}) {
|
|
26
|
-
const config = cloneObjectExceptFunctions(DefaultJestConfig);
|
|
27
|
-
if (react) {
|
|
28
|
-
config.jsc.transform = {
|
|
29
|
-
react: {
|
|
30
|
-
// Use "react/jsx-runtime".
|
|
31
|
-
runtime: "automatic",
|
|
32
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
33
|
-
useBuiltins: true
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (parser === "ecmascript") {
|
|
38
|
-
const parserConfig = { syntax: "ecmascript" };
|
|
39
|
-
if (react) {
|
|
40
|
-
parserConfig.jsx = true;
|
|
41
|
-
}
|
|
42
|
-
config.jsc.parser = parserConfig;
|
|
43
|
-
} else if (react) {
|
|
44
|
-
config.jsc.parser.tsx = true;
|
|
45
|
-
}
|
|
46
|
-
return resolveOverrides(config, configOverride);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { DefaultJestConfig, defineJestConfig };
|
package/dist/chunk-JW562DWU.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { cloneObjectExceptFunctions } from './chunk-XCGQZSNA.mjs';
|
|
2
|
-
import { resolveOverrides } from './chunk-4LXCYXR5.mjs';
|
|
3
|
-
|
|
4
|
-
// src/build.ts
|
|
5
|
-
var DefaultBuildConfig = {
|
|
6
|
-
jsc: {
|
|
7
|
-
parser: {
|
|
8
|
-
syntax: "typescript",
|
|
9
|
-
tsx: true
|
|
10
|
-
},
|
|
11
|
-
// The output environment that the code will be compiled for.
|
|
12
|
-
target: "es2022",
|
|
13
|
-
// View https://swc.rs/docs/configuration/minification for options.
|
|
14
|
-
minify: {
|
|
15
|
-
compress: true,
|
|
16
|
-
mangle: true
|
|
17
|
-
},
|
|
18
|
-
transform: {
|
|
19
|
-
react: {
|
|
20
|
-
// Use "react/jsx-runtime".
|
|
21
|
-
runtime: "automatic",
|
|
22
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
23
|
-
useBuiltins: true
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
27
|
-
// Requires to add "@swc/helpers" as a project dependency
|
|
28
|
-
externalHelpers: true
|
|
29
|
-
},
|
|
30
|
-
module: {
|
|
31
|
-
// The output module resolution system that the code will be compiled for.
|
|
32
|
-
type: "es6",
|
|
33
|
-
// Prevent SWC from exporting the `__esModule` property.
|
|
34
|
-
strict: true,
|
|
35
|
-
// Preserve dynamic imports.
|
|
36
|
-
ignoreDynamic: true
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
function defineBuildConfig({ parser, configOverride } = {}) {
|
|
40
|
-
const config = cloneObjectExceptFunctions(DefaultBuildConfig);
|
|
41
|
-
if (parser === "ecmascript") {
|
|
42
|
-
config.jsc.parser = {
|
|
43
|
-
syntax: "ecmascript",
|
|
44
|
-
jsx: true
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return resolveOverrides(config, configOverride);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { DefaultBuildConfig, defineBuildConfig };
|