@workleap/swc-configs 2.2.3 → 2.2.5
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 +22 -10
- package/README.md +2 -2
- package/dist/applyTransformers.d.ts +4 -7
- package/dist/applyTransformers.js +47 -4
- package/dist/applyTransformers.js.map +1 -0
- package/dist/applyTransformers.mjs +9 -1
- package/dist/applyTransformers.mjs.map +1 -0
- package/dist/browserslistToSwc.d.ts +4 -7
- package/dist/browserslistToSwc.js +187 -67
- package/dist/browserslistToSwc.js.map +1 -0
- package/dist/browserslistToSwc.mjs +140 -1
- package/dist/browserslistToSwc.mjs.map +1 -0
- package/dist/build.d.ts +6 -9
- package/dist/build.js +94 -53
- package/dist/build.js.map +1 -0
- package/dist/build.mjs +54 -2
- package/dist/build.mjs.map +1 -0
- package/dist/dev.d.ts +6 -9
- package/dist/dev.js +92 -52
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +52 -2
- package/dist/dev.mjs.map +1 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +120 -222
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -0
- package/dist/jest.d.ts +6 -9
- package/dist/jest.js +84 -44
- package/dist/jest.js.map +1 -0
- package/dist/jest.mjs +44 -2
- package/dist/jest.mjs.map +1 -0
- package/package.json +24 -24
- package/src/applyTransformers.ts +11 -0
- package/src/browserslistToSwc.ts +155 -0
- package/src/build.ts +64 -0
- package/src/dev.ts +64 -0
- package/src/index.ts +9 -0
- package/src/jest.ts +58 -0
- package/dist/applyTransformers.d.mts +0 -9
- package/dist/browserslistToSwc.d.mts +0 -9
- package/dist/build.d.mts +0 -12
- package/dist/chunk-3UBBOKDF.mjs +0 -6
- package/dist/chunk-G3VHSALI.mjs +0 -53
- package/dist/chunk-JXCM6TQ3.mjs +0 -45
- package/dist/chunk-MGMFB3UY.mjs +0 -73
- package/dist/chunk-OLWWFWTT.mjs +0 -54
- package/dist/dev.d.mts +0 -13
- package/dist/index.d.mts +0 -7
- package/dist/jest.d.mts +0 -13
package/dist/dev.mjs
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__applyTransformers_mjs_b5d980dd__ from "./applyTransformers.mjs";
|
|
2
|
+
|
|
3
|
+
;// CONCATENATED MODULE: external "./applyTransformers.mjs"
|
|
4
|
+
|
|
5
|
+
;// CONCATENATED MODULE: ./src/dev.ts?__rslib_entry__
|
|
6
|
+
|
|
7
|
+
function defineDevConfig(targets, options = {}) {
|
|
8
|
+
const { baseUrl, fastRefresh = true, parser = "typescript", paths, transformers = [] } = options;
|
|
9
|
+
const config = {
|
|
10
|
+
jsc: {
|
|
11
|
+
baseUrl,
|
|
12
|
+
paths,
|
|
13
|
+
parser: parser === "ecmascript" ? {
|
|
14
|
+
syntax: "ecmascript",
|
|
15
|
+
jsx: true
|
|
16
|
+
} : {
|
|
17
|
+
syntax: "typescript",
|
|
18
|
+
tsx: true
|
|
19
|
+
},
|
|
20
|
+
transform: {
|
|
21
|
+
react: {
|
|
22
|
+
// Use "react/jsx-runtime".
|
|
23
|
+
runtime: "automatic",
|
|
24
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
25
|
+
useBuiltins: true,
|
|
26
|
+
// Enable React experimental "fast-refresh" feature.
|
|
27
|
+
// Also need to install @pmmmwh/react-refresh-webpack-plugin.
|
|
28
|
+
refresh: fastRefresh
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
32
|
+
// Requires to add "@swc/helpers" as a project dependency.
|
|
33
|
+
externalHelpers: true
|
|
34
|
+
},
|
|
35
|
+
module: {
|
|
36
|
+
// The output module resolution system that the code will be compiled for.
|
|
37
|
+
type: "es6"
|
|
38
|
+
},
|
|
39
|
+
env: {
|
|
40
|
+
// jsc.target is not provided because the provided targets takes precedence.
|
|
41
|
+
targets
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const transformedConfig = (0,__WEBPACK_EXTERNAL_MODULE__applyTransformers_mjs_b5d980dd__.applyTransformers)(config, transformers, {
|
|
45
|
+
environment: "dev"
|
|
46
|
+
});
|
|
47
|
+
return transformedConfig;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { defineDevConfig };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.mjs","sources":["webpack://@workleap/swc-configs/./src/dev.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\nimport { applyTransformers, type SwcConfigTransformer } from \"./applyTransformers.ts\";\n\nexport interface DefineDevConfigOptions {\n baseUrl?: NonNullable<SwcConfig[\"jsc\"]>[\"baseUrl\"];\n fastRefresh?: boolean;\n parser?: \"ecmascript\" | \"typescript\";\n paths?: NonNullable<SwcConfig[\"jsc\"]>[\"paths\"];\n transformers?: SwcConfigTransformer[];\n}\n\nexport function defineDevConfig(targets: Record<string, string>, options: DefineDevConfigOptions = {}) {\n const {\n baseUrl,\n fastRefresh = true,\n parser = \"typescript\",\n paths,\n transformers = []\n } = options;\n\n const config: SwcConfig = {\n jsc: {\n baseUrl,\n paths,\n parser: parser === \"ecmascript\"\n ? {\n syntax: \"ecmascript\",\n jsx: true\n }\n : {\n syntax: \"typescript\",\n tsx: true\n },\n transform: {\n react: {\n // Use \"react/jsx-runtime\".\n runtime: \"automatic\",\n // Use the native \"Object.assign()\" instead of \"_extends\".\n useBuiltins: true,\n // Enable React experimental \"fast-refresh\" feature.\n // Also need to install @pmmmwh/react-refresh-webpack-plugin.\n refresh: fastRefresh\n }\n },\n // Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.\n // Requires to add \"@swc/helpers\" as a project dependency.\n externalHelpers: true\n },\n module: {\n // The output module resolution system that the code will be compiled for.\n type: \"es6\"\n },\n env: {\n // jsc.target is not provided because the provided targets takes precedence.\n targets\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"dev\"\n });\n\n return transformedConfig;\n}\n"],"names":["applyTransformers","defineDevConfig","targets","options","baseUrl","fastRefresh","parser","paths","transformers","config","transformedConfig"],"mappings":";;;;;AACsF;AAU/E,SAASC,gBAAgBC,OAA+B,EAAEC,UAAkC,CAAC,CAAC;IACjG,MAAM,EACFC,OAAO,EACPC,cAAc,IAAI,EAClBC,SAAS,YAAY,EACrBC,KAAK,EACLC,eAAe,EAAE,EACpB,GAAGL;IAEJ,MAAMM,SAAoB;QACtB,KAAK;YACDL;YACAG;YACA,QAAQD,WAAW,eACb;gBACE,QAAQ;gBACR,KAAK;YACT,IACE;gBACE,QAAQ;gBACR,KAAK;YACT;YACJ,WAAW;gBACP,OAAO;oBACH,2BAA2B;oBAC3B,SAAS;oBACT,0DAA0D;oBAC1D,aAAa;oBACb,oDAAoD;oBACpD,6DAA6D;oBAC7D,SAASD;gBACb;YACJ;YACA,qHAAqH;YACrH,0DAA0D;YAC1D,iBAAiB;QACrB;QACA,QAAQ;YACJ,0EAA0E;YAC1E,MAAM;QACV;QACA,KAAK;YACD,4EAA4E;YAC5EH;QACJ;IACJ;IAEA,MAAMQ,oBAAoBV,iFAAiBA,CAACS,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOE;AACX"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export { SwcConfigTransformer, SwcConfigTransformerContext } from
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
import type { Config as SwcConfig } from "@swc/core";
|
|
2
|
+
export type { SwcConfigTransformer, SwcConfigTransformerContext } from "./applyTransformers.ts";
|
|
3
|
+
export * from "./browserslistToSwc.ts";
|
|
4
|
+
export * from "./build.ts";
|
|
5
|
+
export * from "./dev.ts";
|
|
6
|
+
export * from "./jest.ts";
|
|
7
|
+
export type { SwcConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,231 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"edge",
|
|
13
|
-
"firefox",
|
|
14
|
-
"chrome",
|
|
15
|
-
"safari",
|
|
16
|
-
"opera",
|
|
17
|
-
"ios",
|
|
18
|
-
"android",
|
|
19
|
-
"op_mob",
|
|
20
|
-
"and_chr",
|
|
21
|
-
"and_ff",
|
|
22
|
-
"ie_mob",
|
|
23
|
-
"samsung"
|
|
24
|
-
];
|
|
25
|
-
var SwcMobileBrowserAliases = {
|
|
26
|
-
"and_chr": "chrome",
|
|
27
|
-
"and_ff": "firefox",
|
|
28
|
-
"ie_mob": "ie",
|
|
29
|
-
"ios_saf": "ios",
|
|
30
|
-
"op_mob": "opera"
|
|
31
|
-
};
|
|
32
|
-
function parseBrowserslistEntry(entry) {
|
|
33
|
-
const values = entry.split(" ");
|
|
34
|
-
let browser = values[0];
|
|
35
|
-
let version = values[1];
|
|
36
|
-
if (SwcMobileBrowserAliases[browser]) {
|
|
37
|
-
browser = SwcMobileBrowserAliases[browser];
|
|
38
|
-
}
|
|
39
|
-
if (version.includes("-")) {
|
|
40
|
-
version = version.slice(0, version.indexOf("-"));
|
|
41
|
-
}
|
|
42
|
-
if (version.endsWith(".0")) {
|
|
43
|
-
version = version.slice(0, -2);
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
browser,
|
|
47
|
-
version
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function createSwcTargetsFromBrowserslistEntries(entries) {
|
|
51
|
-
return entries.reduce((acc, x) => {
|
|
52
|
-
const { browser, version } = parseBrowserslistEntry(x);
|
|
53
|
-
if (SwcSupportedBrowsers.indexOf(browser) === -1) {
|
|
54
|
-
return acc;
|
|
55
|
-
}
|
|
56
|
-
const _browser = browser;
|
|
57
|
-
if (acc[_browser]) {
|
|
58
|
-
if (parseFloat(acc[_browser]) > parseFloat(version)) {
|
|
59
|
-
acc[_browser] = version;
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
acc[_browser] = version;
|
|
63
|
-
}
|
|
64
|
-
return acc;
|
|
65
|
-
}, {});
|
|
66
|
-
}
|
|
67
|
-
function browserslistToSwc(options = {}) {
|
|
68
|
-
const {
|
|
69
|
-
queries,
|
|
70
|
-
...browserlistsOptions
|
|
71
|
-
} = options;
|
|
72
|
-
const entries = browserslist__default.default(queries, {
|
|
73
|
-
path: "./browserslistrc",
|
|
74
|
-
...browserlistsOptions
|
|
75
|
-
});
|
|
76
|
-
return createSwcTargetsFromBrowserslistEntries(entries);
|
|
77
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
var __webpack_modules__ = ({
|
|
10
|
+
"./browserslistToSwc.ts": (function (module) {
|
|
11
|
+
module.exports = require("./browserslistToSwc.js");
|
|
78
12
|
|
|
79
|
-
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
}
|
|
13
|
+
}),
|
|
14
|
+
"./build.ts": (function (module) {
|
|
15
|
+
module.exports = require("./build.js");
|
|
83
16
|
|
|
84
|
-
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
mangle: true
|
|
107
|
-
},
|
|
108
|
-
transform: {
|
|
109
|
-
react: {
|
|
110
|
-
// Use "react/jsx-runtime".
|
|
111
|
-
runtime: "automatic",
|
|
112
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
113
|
-
useBuiltins: true
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
117
|
-
// Requires to add "@swc/helpers" as a project dependency.
|
|
118
|
-
externalHelpers: true
|
|
119
|
-
},
|
|
120
|
-
module: {
|
|
121
|
-
// The output module resolution system that the code will be compiled for.
|
|
122
|
-
type: "es6"
|
|
123
|
-
},
|
|
124
|
-
env: {
|
|
125
|
-
// jsc.target is not provided because the provided targets takes precedence.
|
|
126
|
-
targets
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const transformedConfig = applyTransformers(config, transformers, {
|
|
130
|
-
environment: "build"
|
|
131
|
-
});
|
|
132
|
-
return transformedConfig;
|
|
17
|
+
}),
|
|
18
|
+
"./dev.ts": (function (module) {
|
|
19
|
+
module.exports = require("./dev.js");
|
|
20
|
+
|
|
21
|
+
}),
|
|
22
|
+
"./jest.ts": (function (module) {
|
|
23
|
+
module.exports = require("./jest.js");
|
|
24
|
+
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
});
|
|
28
|
+
/************************************************************************/
|
|
29
|
+
// The module cache
|
|
30
|
+
var __webpack_module_cache__ = {};
|
|
31
|
+
|
|
32
|
+
// The require function
|
|
33
|
+
function __webpack_require__(moduleId) {
|
|
34
|
+
|
|
35
|
+
// Check if module is in cache
|
|
36
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
37
|
+
if (cachedModule !== undefined) {
|
|
38
|
+
return cachedModule.exports;
|
|
133
39
|
}
|
|
40
|
+
// Create a new module (and put it into the cache)
|
|
41
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
42
|
+
exports: {}
|
|
43
|
+
});
|
|
44
|
+
// Execute the module function
|
|
45
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
46
|
+
|
|
47
|
+
// Return the exports of the module
|
|
48
|
+
return module.exports;
|
|
134
49
|
|
|
135
|
-
// src/dev.ts
|
|
136
|
-
function defineDevConfig(targets, options = {}) {
|
|
137
|
-
const {
|
|
138
|
-
baseUrl,
|
|
139
|
-
fastRefresh = true,
|
|
140
|
-
parser = "typescript",
|
|
141
|
-
paths,
|
|
142
|
-
transformers = []
|
|
143
|
-
} = options;
|
|
144
|
-
const config = {
|
|
145
|
-
jsc: {
|
|
146
|
-
baseUrl,
|
|
147
|
-
paths,
|
|
148
|
-
parser: parser === "ecmascript" ? {
|
|
149
|
-
syntax: "ecmascript",
|
|
150
|
-
jsx: true
|
|
151
|
-
} : {
|
|
152
|
-
syntax: "typescript",
|
|
153
|
-
tsx: true
|
|
154
|
-
},
|
|
155
|
-
transform: {
|
|
156
|
-
react: {
|
|
157
|
-
// Use "react/jsx-runtime".
|
|
158
|
-
runtime: "automatic",
|
|
159
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
160
|
-
useBuiltins: true,
|
|
161
|
-
// Enable React experimental "fast-refresh" feature.
|
|
162
|
-
// Also need to install @pmmmwh/react-refresh-webpack-plugin.
|
|
163
|
-
refresh: fastRefresh
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
// Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
|
|
167
|
-
// Requires to add "@swc/helpers" as a project dependency.
|
|
168
|
-
externalHelpers: true
|
|
169
|
-
},
|
|
170
|
-
module: {
|
|
171
|
-
// The output module resolution system that the code will be compiled for.
|
|
172
|
-
type: "es6"
|
|
173
|
-
},
|
|
174
|
-
env: {
|
|
175
|
-
// jsc.target is not provided because the provided targets takes precedence.
|
|
176
|
-
targets
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
const transformedConfig = applyTransformers(config, transformers, {
|
|
180
|
-
environment: "dev"
|
|
181
|
-
});
|
|
182
|
-
return transformedConfig;
|
|
183
50
|
}
|
|
184
51
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
},
|
|
205
|
-
// The output environment that the code will be compiled for.
|
|
206
|
-
target: "esnext",
|
|
207
|
-
transform: react ? {
|
|
208
|
-
react: {
|
|
209
|
-
// Use "react/jsx-runtime".
|
|
210
|
-
runtime: "automatic",
|
|
211
|
-
// Use the native "Object.assign()" instead of "_extends".
|
|
212
|
-
useBuiltins: true
|
|
52
|
+
/************************************************************************/
|
|
53
|
+
// webpack/runtime/compat_get_default_export
|
|
54
|
+
(() => {
|
|
55
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
56
|
+
__webpack_require__.n = (module) => {
|
|
57
|
+
var getter = module && module.__esModule ?
|
|
58
|
+
() => (module['default']) :
|
|
59
|
+
() => (module);
|
|
60
|
+
__webpack_require__.d(getter, { a: getter });
|
|
61
|
+
return getter;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
})();
|
|
65
|
+
// webpack/runtime/define_property_getters
|
|
66
|
+
(() => {
|
|
67
|
+
__webpack_require__.d = (exports, definition) => {
|
|
68
|
+
for(var key in definition) {
|
|
69
|
+
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
70
|
+
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
213
71
|
}
|
|
214
|
-
} : void 0
|
|
215
|
-
},
|
|
216
|
-
module: {
|
|
217
|
-
// The output module resolution system that the code will be compiled for.
|
|
218
|
-
type: "es6"
|
|
219
72
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
73
|
+
};
|
|
74
|
+
})();
|
|
75
|
+
// webpack/runtime/has_own_property
|
|
76
|
+
(() => {
|
|
77
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
78
|
+
})();
|
|
79
|
+
// webpack/runtime/make_namespace_object
|
|
80
|
+
(() => {
|
|
81
|
+
// define __esModule on exports
|
|
82
|
+
__webpack_require__.r = (exports) => {
|
|
83
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
84
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
85
|
+
}
|
|
86
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
87
|
+
};
|
|
88
|
+
})();
|
|
89
|
+
/************************************************************************/
|
|
90
|
+
var __webpack_exports__ = {};
|
|
91
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
92
|
+
(() => {
|
|
93
|
+
__webpack_require__.r(__webpack_exports__);
|
|
94
|
+
/* ESM import */var _browserslistToSwc_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./browserslistToSwc.ts");
|
|
95
|
+
/* ESM import */var _browserslistToSwc_ts__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_browserslistToSwc_ts__WEBPACK_IMPORTED_MODULE_0__);
|
|
96
|
+
|
|
97
|
+
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
98
|
+
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _browserslistToSwc_ts__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _browserslistToSwc_ts__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
99
|
+
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
100
|
+
/* ESM import */var _build_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./build.ts");
|
|
101
|
+
/* ESM import */var _build_ts__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_build_ts__WEBPACK_IMPORTED_MODULE_1__);
|
|
102
|
+
|
|
103
|
+
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
104
|
+
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _build_ts__WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _build_ts__WEBPACK_IMPORTED_MODULE_1__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
105
|
+
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
106
|
+
/* ESM import */var _dev_ts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./dev.ts");
|
|
107
|
+
/* ESM import */var _dev_ts__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_dev_ts__WEBPACK_IMPORTED_MODULE_2__);
|
|
108
|
+
|
|
109
|
+
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
110
|
+
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _dev_ts__WEBPACK_IMPORTED_MODULE_2__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _dev_ts__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
111
|
+
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
112
|
+
/* ESM import */var _jest_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./jest.ts");
|
|
113
|
+
/* ESM import */var _jest_ts__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jest_ts__WEBPACK_IMPORTED_MODULE_3__);
|
|
114
|
+
|
|
115
|
+
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
116
|
+
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _jest_ts__WEBPACK_IMPORTED_MODULE_3__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _jest_ts__WEBPACK_IMPORTED_MODULE_3__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
|
|
117
|
+
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
})();
|
|
124
|
+
|
|
125
|
+
var __webpack_export_target__ = exports;
|
|
126
|
+
for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
127
|
+
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true });
|
|
226
128
|
|
|
227
|
-
|
|
228
|
-
exports.createSwcTargetsFromBrowserslistEntries = createSwcTargetsFromBrowserslistEntries;
|
|
229
|
-
exports.defineBuildConfig = defineBuildConfig;
|
|
230
|
-
exports.defineDevConfig = defineDevConfig;
|
|
231
|
-
exports.defineJestConfig = defineJestConfig;
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["webpack://@workleap/swc-configs/./src/index.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\n\nexport type { SwcConfigTransformer, SwcConfigTransformerContext } from \"./applyTransformers.ts\";\nexport * from \"./browserslistToSwc.ts\";\nexport * from \"./build.ts\";\nexport * from \"./dev.ts\";\nexport * from \"./jest.ts\";\nexport type { SwcConfig };\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGuC;AACZ;AACF;AACC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
1
|
+
export * from "./browserslistToSwc.mjs";
|
|
2
|
+
export * from "./build.mjs";
|
|
3
|
+
export * from "./dev.mjs";
|
|
4
|
+
export * from "./jest.mjs";
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["webpack://@workleap/swc-configs/./src/index.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\n\nexport type { SwcConfigTransformer, SwcConfigTransformerContext } from \"./applyTransformers.ts\";\nexport * from \"./browserslistToSwc.ts\";\nexport * from \"./build.ts\";\nexport * from \"./dev.ts\";\nexport * from \"./jest.ts\";\nexport type { SwcConfig };\n\n"],"names":[],"mappings":";;;;;;AAGuC;AACZ;AACF;AACC"}
|
package/dist/jest.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { Config } from
|
|
2
|
-
import { SwcConfigTransformer } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
baseUrl?: NonNullable<Config["jsc"]>["baseUrl"];
|
|
1
|
+
import type { Config as SwcConfig } from "@swc/core";
|
|
2
|
+
import { type SwcConfigTransformer } from "./applyTransformers.ts";
|
|
3
|
+
export interface DefineJestConfigOptions {
|
|
4
|
+
baseUrl?: NonNullable<SwcConfig["jsc"]>["baseUrl"];
|
|
6
5
|
parser?: "ecmascript" | "typescript";
|
|
7
|
-
paths?: NonNullable<
|
|
6
|
+
paths?: NonNullable<SwcConfig["jsc"]>["paths"];
|
|
8
7
|
react?: boolean;
|
|
9
8
|
transformers?: SwcConfigTransformer[];
|
|
10
9
|
}
|
|
11
|
-
declare function defineJestConfig(options?: DefineJestConfigOptions):
|
|
12
|
-
|
|
13
|
-
export { type DefineJestConfigOptions, defineJestConfig };
|
|
10
|
+
export declare function defineJestConfig(options?: DefineJestConfigOptions): SwcConfig;
|
package/dist/jest.js
CHANGED
|
@@ -1,50 +1,90 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
2
11
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
/************************************************************************/
|
|
13
|
+
// webpack/runtime/define_property_getters
|
|
14
|
+
(() => {
|
|
15
|
+
__webpack_require__.d = (exports, definition) => {
|
|
16
|
+
for(var key in definition) {
|
|
17
|
+
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
18
|
+
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
})();
|
|
23
|
+
// webpack/runtime/has_own_property
|
|
24
|
+
(() => {
|
|
25
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
26
|
+
})();
|
|
27
|
+
// webpack/runtime/make_namespace_object
|
|
28
|
+
(() => {
|
|
29
|
+
// define __esModule on exports
|
|
30
|
+
__webpack_require__.r = (exports) => {
|
|
31
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
32
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
/************************************************************************/
|
|
38
|
+
var __webpack_exports__ = {};
|
|
39
|
+
// ESM COMPAT FLAG
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
|
|
42
|
+
// EXPORTS
|
|
43
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
44
|
+
defineJestConfig: () => (/* binding */ defineJestConfig)
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
;// CONCATENATED MODULE: external "./applyTransformers.js"
|
|
48
|
+
const external_applyTransformers_js_namespaceObject = require("./applyTransformers.js");
|
|
49
|
+
;// CONCATENATED MODULE: ./src/jest.ts?__rslib_entry__
|
|
7
50
|
|
|
8
|
-
// src/jest.ts
|
|
9
51
|
function defineJestConfig(options = {}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
const { baseUrl, parser = "typescript", paths, react = false, transformers = [] } = options;
|
|
53
|
+
const config = {
|
|
54
|
+
jsc: {
|
|
55
|
+
baseUrl,
|
|
56
|
+
paths,
|
|
57
|
+
parser: parser === "ecmascript" ? {
|
|
58
|
+
syntax: "ecmascript",
|
|
59
|
+
jsx: react
|
|
60
|
+
} : {
|
|
61
|
+
syntax: "typescript",
|
|
62
|
+
tsx: react
|
|
63
|
+
},
|
|
64
|
+
// The output environment that the code will be compiled for.
|
|
65
|
+
target: "esnext",
|
|
66
|
+
transform: react ? {
|
|
67
|
+
react: {
|
|
68
|
+
// Use "react/jsx-runtime".
|
|
69
|
+
runtime: "automatic",
|
|
70
|
+
// Use the native "Object.assign()" instead of "_extends".
|
|
71
|
+
useBuiltins: true
|
|
72
|
+
}
|
|
73
|
+
} : undefined
|
|
74
|
+
},
|
|
75
|
+
module: {
|
|
76
|
+
// The output module resolution system that the code will be compiled for.
|
|
77
|
+
type: "es6"
|
|
36
78
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const transformedConfig = applyTransformers(config, transformers, {
|
|
45
|
-
environment: "jest"
|
|
46
|
-
});
|
|
47
|
-
return transformedConfig;
|
|
79
|
+
};
|
|
80
|
+
const transformedConfig = (0,external_applyTransformers_js_namespaceObject.applyTransformers)(config, transformers, {
|
|
81
|
+
environment: "jest"
|
|
82
|
+
});
|
|
83
|
+
return transformedConfig;
|
|
48
84
|
}
|
|
49
85
|
|
|
50
|
-
|
|
86
|
+
var __webpack_export_target__ = exports;
|
|
87
|
+
for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
88
|
+
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true });
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=jest.js.map
|
package/dist/jest.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.js","sources":["webpack://@workleap/swc-configs/./src/jest.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\nimport { applyTransformers, type SwcConfigTransformer } from \"./applyTransformers.ts\";\n\nexport interface DefineJestConfigOptions {\n baseUrl?: NonNullable<SwcConfig[\"jsc\"]>[\"baseUrl\"];\n parser?: \"ecmascript\" | \"typescript\";\n paths?: NonNullable<SwcConfig[\"jsc\"]>[\"paths\"];\n react?: boolean;\n transformers?: SwcConfigTransformer[];\n}\n\nexport function defineJestConfig(options: DefineJestConfigOptions = {}) {\n const {\n baseUrl,\n parser = \"typescript\",\n paths,\n react = false,\n transformers = []\n } = options;\n\n const config: SwcConfig = {\n jsc: {\n baseUrl,\n paths,\n parser: parser === \"ecmascript\"\n ? {\n syntax: \"ecmascript\",\n jsx: react\n }\n : {\n syntax: \"typescript\",\n tsx: react\n },\n // The output environment that the code will be compiled for.\n target: \"esnext\",\n transform: react\n ? {\n react: {\n // Use \"react/jsx-runtime\".\n runtime: \"automatic\",\n // Use the native \"Object.assign()\" instead of \"_extends\".\n useBuiltins: true\n }\n }\n : undefined\n },\n module: {\n // The output module resolution system that the code will be compiled for.\n type: \"es6\"\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"jest\"\n });\n\n return transformedConfig;\n}\n"],"names":["applyTransformers","defineJestConfig","options","baseUrl","parser","paths","react","transformers","config","undefined","transformedConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACsF;AAU/E,SAASC,iBAAiBC,UAAmC,CAAC,CAAC;IAClE,MAAM,EACFC,OAAO,EACPC,SAAS,YAAY,EACrBC,KAAK,EACLC,QAAQ,KAAK,EACbC,eAAe,EAAE,EACpB,GAAGL;IAEJ,MAAMM,SAAoB;QACtB,KAAK;YACDL;YACAE;YACA,QAAQD,WAAW,eACb;gBACE,QAAQ;gBACR,KAAKE;YACT,IACE;gBACE,QAAQ;gBACR,KAAKA;YACT;YACJ,6DAA6D;YAC7D,QAAQ;YACR,WAAWA,QACL;gBACE,OAAO;oBACH,2BAA2B;oBAC3B,SAAS;oBACT,0DAA0D;oBAC1D,aAAa;gBACjB;YACJ,IACEG;QACV;QACA,QAAQ;YACJ,0EAA0E;YAC1E,MAAM;QACV;IACJ;IAEA,MAAMC,oBAAoBV,mEAAiBA,CAACQ,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOG;AACX"}
|