@workleap/swc-configs 2.2.3 → 2.2.4

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/applyTransformers.d.ts +4 -7
  3. package/dist/applyTransformers.js +51 -4
  4. package/dist/applyTransformers.js.map +1 -0
  5. package/dist/applyTransformers.mjs +9 -1
  6. package/dist/applyTransformers.mjs.map +1 -0
  7. package/dist/browserslistToSwc.d.ts +4 -7
  8. package/dist/browserslistToSwc.js +194 -67
  9. package/dist/browserslistToSwc.js.map +1 -0
  10. package/dist/browserslistToSwc.mjs +140 -1
  11. package/dist/browserslistToSwc.mjs.map +1 -0
  12. package/dist/build.d.ts +6 -9
  13. package/dist/build.js +98 -53
  14. package/dist/build.js.map +1 -0
  15. package/dist/build.mjs +54 -2
  16. package/dist/build.mjs.map +1 -0
  17. package/dist/dev.d.ts +6 -9
  18. package/dist/dev.js +96 -52
  19. package/dist/dev.js.map +1 -0
  20. package/dist/dev.mjs +52 -2
  21. package/dist/dev.mjs.map +1 -0
  22. package/dist/index.d.ts +7 -7
  23. package/dist/index.js +127 -222
  24. package/dist/index.js.map +1 -0
  25. package/dist/index.mjs +13 -5
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/jest.d.ts +6 -9
  28. package/dist/jest.js +88 -44
  29. package/dist/jest.js.map +1 -0
  30. package/dist/jest.mjs +44 -2
  31. package/dist/jest.mjs.map +1 -0
  32. package/package.json +24 -22
  33. package/src/applyTransformers.ts +11 -0
  34. package/src/browserslistToSwc.ts +155 -0
  35. package/src/build.ts +64 -0
  36. package/src/dev.ts +64 -0
  37. package/src/index.ts +9 -0
  38. package/src/jest.ts +58 -0
  39. package/dist/applyTransformers.d.mts +0 -9
  40. package/dist/browserslistToSwc.d.mts +0 -9
  41. package/dist/build.d.mts +0 -12
  42. package/dist/chunk-3UBBOKDF.mjs +0 -6
  43. package/dist/chunk-G3VHSALI.mjs +0 -53
  44. package/dist/chunk-JXCM6TQ3.mjs +0 -45
  45. package/dist/chunk-MGMFB3UY.mjs +0 -73
  46. package/dist/chunk-OLWWFWTT.mjs +0 -54
  47. package/dist/dev.d.mts +0 -13
  48. package/dist/index.d.mts +0 -7
  49. package/dist/jest.d.mts +0 -13
package/dist/build.js CHANGED
@@ -1,59 +1,104 @@
1
- 'use strict';
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
- // src/applyTransformers.ts
4
- function applyTransformers(config, transformers, context) {
5
- return transformers.reduce((acc, transformer) => transformer(acc, context), config);
6
- }
12
+ /************************************************************************/
13
+ // webpack/runtime/define_property_getters
14
+ (() => {
15
+ __webpack_require__.d = function(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 = function (obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = function(exports) {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+
40
+ })();
41
+ /************************************************************************/
42
+ var __webpack_exports__ = {};
43
+ // ESM COMPAT FLAG
44
+ __webpack_require__.r(__webpack_exports__);
45
+
46
+ // EXPORTS
47
+ __webpack_require__.d(__webpack_exports__, {
48
+ defineBuildConfig: () => (/* binding */ defineBuildConfig)
49
+ });
50
+
51
+ ;// CONCATENATED MODULE: external "./applyTransformers.js"
52
+ const external_applyTransformers_js_namespaceObject = require("./applyTransformers.js");
53
+ ;// CONCATENATED MODULE: ./src/build.ts?__rslib_entry__
7
54
 
8
- // src/build.ts
9
55
  function defineBuildConfig(targets, options = {}) {
10
- const {
11
- baseUrl,
12
- parser = "typescript",
13
- paths,
14
- transformers = []
15
- } = options;
16
- const config = {
17
- jsc: {
18
- baseUrl,
19
- paths,
20
- parser: parser === "ecmascript" ? {
21
- syntax: "ecmascript",
22
- jsx: true
23
- } : {
24
- syntax: "typescript",
25
- tsx: true
26
- },
27
- // View https://swc.rs/docs/configuration/minification for options.
28
- minify: {
29
- compress: true,
30
- mangle: true
31
- },
32
- transform: {
33
- react: {
34
- // Use "react/jsx-runtime".
35
- runtime: "automatic",
36
- // Use the native "Object.assign()" instead of "_extends".
37
- useBuiltins: true
56
+ const { baseUrl, parser = "typescript", paths, transformers = [] } = options;
57
+ const config = {
58
+ jsc: {
59
+ baseUrl,
60
+ paths,
61
+ parser: parser === "ecmascript" ? {
62
+ syntax: "ecmascript",
63
+ jsx: true
64
+ } : {
65
+ syntax: "typescript",
66
+ tsx: true
67
+ },
68
+ // View https://swc.rs/docs/configuration/minification for options.
69
+ minify: {
70
+ compress: true,
71
+ mangle: true
72
+ },
73
+ transform: {
74
+ react: {
75
+ // Use "react/jsx-runtime".
76
+ runtime: "automatic",
77
+ // Use the native "Object.assign()" instead of "_extends".
78
+ useBuiltins: true
79
+ }
80
+ },
81
+ // Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
82
+ // Requires to add "@swc/helpers" as a project dependency.
83
+ externalHelpers: true
84
+ },
85
+ module: {
86
+ // The output module resolution system that the code will be compiled for.
87
+ type: "es6"
88
+ },
89
+ env: {
90
+ // jsc.target is not provided because the provided targets takes precedence.
91
+ targets
38
92
  }
39
- },
40
- // Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
41
- // Requires to add "@swc/helpers" as a project dependency.
42
- externalHelpers: true
43
- },
44
- module: {
45
- // The output module resolution system that the code will be compiled for.
46
- type: "es6"
47
- },
48
- env: {
49
- // jsc.target is not provided because the provided targets takes precedence.
50
- targets
51
- }
52
- };
53
- const transformedConfig = applyTransformers(config, transformers, {
54
- environment: "build"
55
- });
56
- return transformedConfig;
93
+ };
94
+ const transformedConfig = (0,external_applyTransformers_js_namespaceObject.applyTransformers)(config, transformers, {
95
+ environment: "build"
96
+ });
97
+ return transformedConfig;
57
98
  }
58
99
 
59
- exports.defineBuildConfig = defineBuildConfig;
100
+ var __webpack_export_target__ = exports;
101
+ for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
102
+ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true });
103
+
104
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sources":["webpack://@workleap/swc-configs/./src/build.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\nimport { applyTransformers, type SwcConfigTransformer } from \"./applyTransformers.ts\";\n\nexport interface DefineBuildConfigOptions {\n baseUrl?: NonNullable<SwcConfig[\"jsc\"]>[\"baseUrl\"];\n parser?: \"ecmascript\" | \"typescript\";\n paths?: NonNullable<SwcConfig[\"jsc\"]>[\"paths\"];\n transformers?: SwcConfigTransformer[];\n}\n\nexport function defineBuildConfig(targets: Record<string, string>, options: DefineBuildConfigOptions = {}) {\n const {\n baseUrl,\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 // View https://swc.rs/docs/configuration/minification for options.\n minify: {\n compress: true,\n mangle: 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 }\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: \"build\"\n });\n\n return transformedConfig;\n}\n"],"names":["applyTransformers","defineBuildConfig","targets","options","baseUrl","parser","paths","transformers","config","transformedConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACsF;AAS/E,SAASC,kBAAkBC,OAA+B,EAAEC,UAAoC,CAAC,CAAC;IACrG,MAAM,EACFC,OAAO,EACPC,SAAS,YAAY,EACrBC,KAAK,EACLC,eAAe,EAAE,EACpB,GAAGJ;IAEJ,MAAMK,SAAoB;QACtB,KAAK;YACDJ;YACAE;YACA,QAAQD,WAAW,eACb;gBACE,QAAQ;gBACR,KAAK;YACT,IACE;gBACE,QAAQ;gBACR,KAAK;YACT;YACJ,mEAAmE;YACnE,QAAQ;gBACJ,UAAU;gBACV,QAAQ;YACZ;YACA,WAAW;gBACP,OAAO;oBACH,2BAA2B;oBAC3B,SAAS;oBACT,0DAA0D;oBAC1D,aAAa;gBACjB;YACJ;YACA,qHAAqH;YACrH,0DAA0D;YAC1D,iBAAiB;QACrB;QACA,QAAQ;YACJ,0EAA0E;YAC1E,MAAM;QACV;QACA,KAAK;YACD,4EAA4E;YAC5EH;QACJ;IACJ;IAEA,MAAMO,oBAAoBT,mEAAiBA,CAACQ,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOE;AACX"}
package/dist/build.mjs CHANGED
@@ -1,2 +1,54 @@
1
- export { defineBuildConfig } from './chunk-OLWWFWTT.mjs';
2
- import './chunk-3UBBOKDF.mjs';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__applyTransformers_mjs_b5d980dd__ from "./applyTransformers.mjs";
2
+
3
+ ;// CONCATENATED MODULE: external "./applyTransformers.mjs"
4
+
5
+ ;// CONCATENATED MODULE: ./src/build.ts?__rslib_entry__
6
+
7
+ function defineBuildConfig(targets, options = {}) {
8
+ const { baseUrl, 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
+ // View https://swc.rs/docs/configuration/minification for options.
21
+ minify: {
22
+ compress: true,
23
+ mangle: true
24
+ },
25
+ transform: {
26
+ react: {
27
+ // Use "react/jsx-runtime".
28
+ runtime: "automatic",
29
+ // Use the native "Object.assign()" instead of "_extends".
30
+ useBuiltins: true
31
+ }
32
+ },
33
+ // Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
34
+ // Requires to add "@swc/helpers" as a project dependency.
35
+ externalHelpers: true
36
+ },
37
+ module: {
38
+ // The output module resolution system that the code will be compiled for.
39
+ type: "es6"
40
+ },
41
+ env: {
42
+ // jsc.target is not provided because the provided targets takes precedence.
43
+ targets
44
+ }
45
+ };
46
+ const transformedConfig = (0,__WEBPACK_EXTERNAL_MODULE__applyTransformers_mjs_b5d980dd__.applyTransformers)(config, transformers, {
47
+ environment: "build"
48
+ });
49
+ return transformedConfig;
50
+ }
51
+
52
+ export { defineBuildConfig };
53
+
54
+ //# sourceMappingURL=build.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.mjs","sources":["webpack://@workleap/swc-configs/./src/build.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\nimport { applyTransformers, type SwcConfigTransformer } from \"./applyTransformers.ts\";\n\nexport interface DefineBuildConfigOptions {\n baseUrl?: NonNullable<SwcConfig[\"jsc\"]>[\"baseUrl\"];\n parser?: \"ecmascript\" | \"typescript\";\n paths?: NonNullable<SwcConfig[\"jsc\"]>[\"paths\"];\n transformers?: SwcConfigTransformer[];\n}\n\nexport function defineBuildConfig(targets: Record<string, string>, options: DefineBuildConfigOptions = {}) {\n const {\n baseUrl,\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 // View https://swc.rs/docs/configuration/minification for options.\n minify: {\n compress: true,\n mangle: 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 }\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: \"build\"\n });\n\n return transformedConfig;\n}\n"],"names":["applyTransformers","defineBuildConfig","targets","options","baseUrl","parser","paths","transformers","config","transformedConfig"],"mappings":";;;;;AACsF;AAS/E,SAASC,kBAAkBC,OAA+B,EAAEC,UAAoC,CAAC,CAAC;IACrG,MAAM,EACFC,OAAO,EACPC,SAAS,YAAY,EACrBC,KAAK,EACLC,eAAe,EAAE,EACpB,GAAGJ;IAEJ,MAAMK,SAAoB;QACtB,KAAK;YACDJ;YACAE;YACA,QAAQD,WAAW,eACb;gBACE,QAAQ;gBACR,KAAK;YACT,IACE;gBACE,QAAQ;gBACR,KAAK;YACT;YACJ,mEAAmE;YACnE,QAAQ;gBACJ,UAAU;gBACV,QAAQ;YACZ;YACA,WAAW;gBACP,OAAO;oBACH,2BAA2B;oBAC3B,SAAS;oBACT,0DAA0D;oBAC1D,aAAa;gBACjB;YACJ;YACA,qHAAqH;YACrH,0DAA0D;YAC1D,iBAAiB;QACrB;QACA,QAAQ;YACJ,0EAA0E;YAC1E,MAAM;QACV;QACA,KAAK;YACD,4EAA4E;YAC5EH;QACJ;IACJ;IAEA,MAAMO,oBAAoBT,iFAAiBA,CAACQ,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOE;AACX"}
package/dist/dev.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- import { Config } from '@swc/core';
2
- import { SwcConfigTransformer } from './applyTransformers.js';
3
-
4
- interface DefineDevConfigOptions {
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 DefineDevConfigOptions {
4
+ baseUrl?: NonNullable<SwcConfig["jsc"]>["baseUrl"];
6
5
  fastRefresh?: boolean;
7
6
  parser?: "ecmascript" | "typescript";
8
- paths?: NonNullable<Config["jsc"]>["paths"];
7
+ paths?: NonNullable<SwcConfig["jsc"]>["paths"];
9
8
  transformers?: SwcConfigTransformer[];
10
9
  }
11
- declare function defineDevConfig(targets: Record<string, string>, options?: DefineDevConfigOptions): Config;
12
-
13
- export { type DefineDevConfigOptions, defineDevConfig };
10
+ export declare function defineDevConfig(targets: Record<string, string>, options?: DefineDevConfigOptions): SwcConfig;
package/dist/dev.js CHANGED
@@ -1,58 +1,102 @@
1
- 'use strict';
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
- // src/applyTransformers.ts
4
- function applyTransformers(config, transformers, context) {
5
- return transformers.reduce((acc, transformer) => transformer(acc, context), config);
6
- }
12
+ /************************************************************************/
13
+ // webpack/runtime/define_property_getters
14
+ (() => {
15
+ __webpack_require__.d = function(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 = function (obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = function(exports) {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+
40
+ })();
41
+ /************************************************************************/
42
+ var __webpack_exports__ = {};
43
+ // ESM COMPAT FLAG
44
+ __webpack_require__.r(__webpack_exports__);
45
+
46
+ // EXPORTS
47
+ __webpack_require__.d(__webpack_exports__, {
48
+ defineDevConfig: () => (/* binding */ defineDevConfig)
49
+ });
50
+
51
+ ;// CONCATENATED MODULE: external "./applyTransformers.js"
52
+ const external_applyTransformers_js_namespaceObject = require("./applyTransformers.js");
53
+ ;// CONCATENATED MODULE: ./src/dev.ts?__rslib_entry__
7
54
 
8
- // src/dev.ts
9
55
  function defineDevConfig(targets, options = {}) {
10
- const {
11
- baseUrl,
12
- fastRefresh = true,
13
- parser = "typescript",
14
- paths,
15
- transformers = []
16
- } = options;
17
- const config = {
18
- jsc: {
19
- baseUrl,
20
- paths,
21
- parser: parser === "ecmascript" ? {
22
- syntax: "ecmascript",
23
- jsx: true
24
- } : {
25
- syntax: "typescript",
26
- tsx: true
27
- },
28
- transform: {
29
- react: {
30
- // Use "react/jsx-runtime".
31
- runtime: "automatic",
32
- // Use the native "Object.assign()" instead of "_extends".
33
- useBuiltins: true,
34
- // Enable React experimental "fast-refresh" feature.
35
- // Also need to install @pmmmwh/react-refresh-webpack-plugin.
36
- refresh: fastRefresh
56
+ const { baseUrl, fastRefresh = true, parser = "typescript", paths, transformers = [] } = options;
57
+ const config = {
58
+ jsc: {
59
+ baseUrl,
60
+ paths,
61
+ parser: parser === "ecmascript" ? {
62
+ syntax: "ecmascript",
63
+ jsx: true
64
+ } : {
65
+ syntax: "typescript",
66
+ tsx: true
67
+ },
68
+ transform: {
69
+ react: {
70
+ // Use "react/jsx-runtime".
71
+ runtime: "automatic",
72
+ // Use the native "Object.assign()" instead of "_extends".
73
+ useBuiltins: true,
74
+ // Enable React experimental "fast-refresh" feature.
75
+ // Also need to install @pmmmwh/react-refresh-webpack-plugin.
76
+ refresh: fastRefresh
77
+ }
78
+ },
79
+ // Import shims from an external module rather than inlining them in bundle files to greatly reduce the bundles size.
80
+ // Requires to add "@swc/helpers" as a project dependency.
81
+ externalHelpers: true
82
+ },
83
+ module: {
84
+ // The output module resolution system that the code will be compiled for.
85
+ type: "es6"
86
+ },
87
+ env: {
88
+ // jsc.target is not provided because the provided targets takes precedence.
89
+ targets
37
90
  }
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
42
- },
43
- module: {
44
- // The output module resolution system that the code will be compiled for.
45
- type: "es6"
46
- },
47
- env: {
48
- // jsc.target is not provided because the provided targets takes precedence.
49
- targets
50
- }
51
- };
52
- const transformedConfig = applyTransformers(config, transformers, {
53
- environment: "dev"
54
- });
55
- return transformedConfig;
91
+ };
92
+ const transformedConfig = (0,external_applyTransformers_js_namespaceObject.applyTransformers)(config, transformers, {
93
+ environment: "dev"
94
+ });
95
+ return transformedConfig;
56
96
  }
57
97
 
58
- exports.defineDevConfig = defineDevConfig;
98
+ var __webpack_export_target__ = exports;
99
+ for(var __webpack_i__ in __webpack_exports__) __webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
100
+ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', { value: true });
101
+
102
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","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,mEAAiBA,CAACS,QAAQD,cAAc;QAC9D,aAAa;IACjB;IAEA,OAAOE;AACX"}
package/dist/dev.mjs CHANGED
@@ -1,2 +1,52 @@
1
- export { defineDevConfig } from './chunk-G3VHSALI.mjs';
2
- import './chunk-3UBBOKDF.mjs';
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
@@ -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
- export { Config as SwcConfig } from '@swc/core';
2
- export { SwcConfigTransformer, SwcConfigTransformerContext } from './applyTransformers.js';
3
- export { BrowserslistToSwcOptions, browserslistToSwc, createSwcTargetsFromBrowserslistEntries } from './browserslistToSwc.js';
4
- export { DefineBuildConfigOptions, defineBuildConfig } from './build.js';
5
- export { DefineDevConfigOptions, defineDevConfig } from './dev.js';
6
- export { DefineJestConfigOptions, defineJestConfig } from './jest.js';
7
- import 'browserslist';
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 };