@workleap/swc-configs 2.2.4 → 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 CHANGED
@@ -1,67 +1,73 @@
1
1
  # @workleap/swc-configs
2
2
 
3
+ ## 2.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#242](https://github.com/workleap/wl-web-configs/pull/242) [`e165cb4`](https://github.com/workleap/wl-web-configs/commit/e165cb447e699e19f06d41532216e36c09d7b945) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
8
+
3
9
  ## 2.2.4
4
10
 
5
11
  ### Patch Changes
6
12
 
7
- - [#230](https://github.com/gsoft-inc/wl-web-configs/pull/230) [`0a4279c`](https://github.com/gsoft-inc/wl-web-configs/commit/0a4279c40b7c2ea76c7e1884a8e2fd744ca9b7c1) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Packages now includes the source codes and sourcemap.
13
+ - [#230](https://github.com/workleap/wl-web-configs/pull/230) [`0a4279c`](https://github.com/workleap/wl-web-configs/commit/0a4279c40b7c2ea76c7e1884a8e2fd744ca9b7c1) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Packages now includes the source codes and sourcemap.
8
14
 
9
15
  ## 2.2.3
10
16
 
11
17
  ### Patch Changes
12
18
 
13
- - [#186](https://github.com/gsoft-inc/wl-web-configs/pull/186) [`997054e`](https://github.com/gsoft-inc/wl-web-configs/commit/997054eb66118e5897ce686a446d98ac7ea6abd6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Loosen the dependencies version.
19
+ - [#186](https://github.com/workleap/wl-web-configs/pull/186) [`997054e`](https://github.com/workleap/wl-web-configs/commit/997054eb66118e5897ce686a446d98ac7ea6abd6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Loosen the dependencies version.
14
20
 
15
21
  ## 2.2.2
16
22
 
17
23
  ### Patch Changes
18
24
 
19
- - [#179](https://github.com/gsoft-inc/wl-web-configs/pull/179) [`61d3721`](https://github.com/gsoft-inc/wl-web-configs/commit/61d37216198083ba78cd4b1480e38c8d772a6119) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
25
+ - [#179](https://github.com/workleap/wl-web-configs/pull/179) [`61d3721`](https://github.com/workleap/wl-web-configs/commit/61d37216198083ba78cd4b1480e38c8d772a6119) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
20
26
 
21
27
  ## 2.2.1
22
28
 
23
29
  ### Patch Changes
24
30
 
25
- - [#177](https://github.com/gsoft-inc/wl-web-configs/pull/177) [`8936ce6`](https://github.com/gsoft-inc/wl-web-configs/commit/8936ce677cad205caba2f13a71f5c9208f1dd5e6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated packages dependencies.
31
+ - [#177](https://github.com/workleap/wl-web-configs/pull/177) [`8936ce6`](https://github.com/workleap/wl-web-configs/commit/8936ce677cad205caba2f13a71f5c9208f1dd5e6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated packages dependencies.
26
32
 
27
33
  ## 2.2.0
28
34
 
29
35
  ### Minor Changes
30
36
 
31
- - [#173](https://github.com/gsoft-inc/wl-web-configs/pull/173) [`65df9e7`](https://github.com/gsoft-inc/wl-web-configs/commit/65df9e7bd00bf631c0769d9abe90a5029f5187a0) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added the `baseUrl` and `paths` predefined options.
37
+ - [#173](https://github.com/workleap/wl-web-configs/pull/173) [`65df9e7`](https://github.com/workleap/wl-web-configs/commit/65df9e7bd00bf631c0769d9abe90a5029f5187a0) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added the `baseUrl` and `paths` predefined options.
32
38
 
33
39
  ## 2.1.2
34
40
 
35
41
  ### Patch Changes
36
42
 
37
- - [#143](https://github.com/gsoft-inc/wl-web-configs/pull/143) [`334088f`](https://github.com/gsoft-inc/wl-web-configs/commit/334088fac63aad6cc245ee3300da076e5c201287) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated to SWC 1.3.85
43
+ - [#143](https://github.com/workleap/wl-web-configs/pull/143) [`334088f`](https://github.com/workleap/wl-web-configs/commit/334088fac63aad6cc245ee3300da076e5c201287) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated to SWC 1.3.85
38
44
 
39
45
  ## 2.1.1
40
46
 
41
47
  ### Patch Changes
42
48
 
43
- - [#120](https://github.com/gsoft-inc/wl-web-configs/pull/120) [`0e66000`](https://github.com/gsoft-inc/wl-web-configs/commit/0e66000b2028cad9c606d3523e3bcf540e6350e2) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated configs
49
+ - [#120](https://github.com/workleap/wl-web-configs/pull/120) [`0e66000`](https://github.com/workleap/wl-web-configs/commit/0e66000b2028cad9c606d3523e3bcf540e6350e2) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated configs
44
50
 
45
51
  ## 2.1.0
46
52
 
47
53
  ### Minor Changes
48
54
 
49
- - [#106](https://github.com/gsoft-inc/wl-web-configs/pull/106) [`a747302`](https://github.com/gsoft-inc/wl-web-configs/commit/a74730233d78c71e45bcd8911a706630d359a67c) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fixed SWC targets and support TS 5.2
55
+ - [#106](https://github.com/workleap/wl-web-configs/pull/106) [`a747302`](https://github.com/workleap/wl-web-configs/commit/a74730233d78c71e45bcd8911a706630d359a67c) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fixed SWC targets and support TS 5.2
50
56
 
51
57
  ## 2.0.0
52
58
 
53
59
  ### Major Changes
54
60
 
55
- - [#98](https://github.com/gsoft-inc/wl-web-configs/pull/98) [`56ca32e`](https://github.com/gsoft-inc/wl-web-configs/commit/56ca32ee3194c51210aacc5189f3ebbec5a4a7b6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New start, every package has a major version bump
61
+ - [#98](https://github.com/workleap/wl-web-configs/pull/98) [`56ca32e`](https://github.com/workleap/wl-web-configs/commit/56ca32ee3194c51210aacc5189f3ebbec5a4a7b6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - New start, every package has a major version bump
56
62
 
57
63
  ## 1.0.1
58
64
 
59
65
  ### Patch Changes
60
66
 
61
- - [#92](https://github.com/gsoft-inc/wl-web-configs/pull/92) [`66e8f10`](https://github.com/gsoft-inc/wl-web-configs/commit/66e8f1033a987523c65fe9e61f53dac6d2e38777) Thanks [@ofrogon](https://github.com/ofrogon)! - Migrate project from GitHub organization
67
+ - [#92](https://github.com/workleap/wl-web-configs/pull/92) [`66e8f10`](https://github.com/workleap/wl-web-configs/commit/66e8f1033a987523c65fe9e61f53dac6d2e38777) Thanks [@ofrogon](https://github.com/ofrogon)! - Migrate project from GitHub organization
62
68
 
63
69
  ## 1.0.0
64
70
 
65
71
  ### Major Changes
66
72
 
67
- - [#85](https://github.com/gsoft-inc/wl-web-configs/pull/85) [`bad2df7`](https://github.com/gsoft-inc/wl-web-configs/commit/bad2df75593fb70d431d73bdced653b157c50caa) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated TSUP configuration and added a new SWC config package
73
+ - [#85](https://github.com/workleap/wl-web-configs/pull/85) [`bad2df7`](https://github.com/workleap/wl-web-configs/commit/bad2df75593fb70d431d73bdced653b157c50caa) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated TSUP configuration and added a new SWC config package
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ## Usage
7
7
 
8
- View the [user's documentation](https://gsoft-inc.github.io/wl-web-configs/).
8
+ View the [user's documentation](https://workleap.github.io/wl-web-configs/).
9
9
 
10
10
  ## 🤝 Contributing
11
11
 
@@ -21,4 +21,4 @@ Once all our projects use ESM, CJS support can be removed.
21
21
 
22
22
  ## License
23
23
 
24
- Copyright © 2023, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/gsoft-inc/workleap-license/blob/master/LICENSE.
24
+ Copyright © 2023, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/workleap/workleap-license/blob/master/LICENSE.
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
12
12
  /************************************************************************/
13
13
  // webpack/runtime/define_property_getters
14
14
  (() => {
15
- __webpack_require__.d = function(exports, definition) {
15
+ __webpack_require__.d = (exports, definition) => {
16
16
  for(var key in definition) {
17
17
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
18
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -22,27 +22,23 @@ __webpack_require__.d = function(exports, definition) {
22
22
  })();
23
23
  // webpack/runtime/has_own_property
24
24
  (() => {
25
- __webpack_require__.o = function (obj, prop) {
26
- return Object.prototype.hasOwnProperty.call(obj, prop);
27
- };
28
-
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
26
  })();
30
27
  // webpack/runtime/make_namespace_object
31
28
  (() => {
32
29
  // define __esModule on exports
33
- __webpack_require__.r = function(exports) {
30
+ __webpack_require__.r = (exports) => {
34
31
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
32
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
33
  }
37
34
  Object.defineProperty(exports, '__esModule', { value: true });
38
35
  };
39
-
40
36
  })();
41
37
  /************************************************************************/
42
38
  var __webpack_exports__ = {};
43
39
  __webpack_require__.r(__webpack_exports__);
44
40
  __webpack_require__.d(__webpack_exports__, {
45
- applyTransformers: function() { return applyTransformers; }
41
+ applyTransformers: () => (applyTransformers)
46
42
  });
47
43
  function applyTransformers(config, transformers, context) {
48
44
  return transformers.reduce((acc, transformer)=>transformer(acc, context), config);
@@ -1 +1 @@
1
- {"version":3,"file":"applyTransformers.js","sources":["webpack://@workleap/swc-configs/./src/applyTransformers.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\n\nexport interface SwcConfigTransformerContext {\n environment: \"dev\" | \"build\" | \"jest\";\n}\n\nexport type SwcConfigTransformer = (config: SwcConfig, context: SwcConfigTransformerContext) => SwcConfig;\n\nexport function applyTransformers(config: SwcConfig, transformers: SwcConfigTransformer[], context: SwcConfigTransformerContext) {\n return transformers.reduce((acc, transformer) => transformer(acc, context), config);\n}\n"],"names":["applyTransformers","config","transformers","context","acc","transformer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAASA,kBAAkBC,MAAiB,EAAEC,YAAoC,EAAEC,OAAoC;IAC3H,OAAOD,aAAa,MAAM,CAAC,CAACE,KAAKC,cAAgBA,YAAYD,KAAKD,UAAUF;AAChF"}
1
+ {"version":3,"file":"applyTransformers.js","sources":["webpack://@workleap/swc-configs/./src/applyTransformers.ts"],"sourcesContent":["import type { Config as SwcConfig } from \"@swc/core\";\n\nexport interface SwcConfigTransformerContext {\n environment: \"dev\" | \"build\" | \"jest\";\n}\n\nexport type SwcConfigTransformer = (config: SwcConfig, context: SwcConfigTransformerContext) => SwcConfig;\n\nexport function applyTransformers(config: SwcConfig, transformers: SwcConfigTransformer[], context: SwcConfigTransformerContext) {\n return transformers.reduce((acc, transformer) => transformer(acc, context), config);\n}\n"],"names":["applyTransformers","config","transformers","context","acc","transformer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAASA,kBAAkBC,MAAiB,EAAEC,YAAoC,EAAEC,OAAoC;IAC3H,OAAOD,aAAa,MAAM,CAAC,CAACE,KAAKC,cAAgBA,YAAYD,KAAKD,UAAUF;AAChF"}
@@ -13,21 +13,18 @@ var __webpack_require__ = {};
13
13
  // webpack/runtime/compat_get_default_export
14
14
  (() => {
15
15
  // getDefaultExport function for compatibility with non-ESM modules
16
- __webpack_require__.n = function (module) {
16
+ __webpack_require__.n = (module) => {
17
17
  var getter = module && module.__esModule ?
18
- function () { return module['default']; } :
19
- function () { return module; };
18
+ () => (module['default']) :
19
+ () => (module);
20
20
  __webpack_require__.d(getter, { a: getter });
21
21
  return getter;
22
22
  };
23
23
 
24
-
25
-
26
-
27
24
  })();
28
25
  // webpack/runtime/define_property_getters
29
26
  (() => {
30
- __webpack_require__.d = function(exports, definition) {
27
+ __webpack_require__.d = (exports, definition) => {
31
28
  for(var key in definition) {
32
29
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
33
30
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -37,21 +34,17 @@ __webpack_require__.d = function(exports, definition) {
37
34
  })();
38
35
  // webpack/runtime/has_own_property
39
36
  (() => {
40
- __webpack_require__.o = function (obj, prop) {
41
- return Object.prototype.hasOwnProperty.call(obj, prop);
42
- };
43
-
37
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
44
38
  })();
45
39
  // webpack/runtime/make_namespace_object
46
40
  (() => {
47
41
  // define __esModule on exports
48
- __webpack_require__.r = function(exports) {
42
+ __webpack_require__.r = (exports) => {
49
43
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
50
44
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
51
45
  }
52
46
  Object.defineProperty(exports, '__esModule', { value: true });
53
47
  };
54
-
55
48
  })();
56
49
  /************************************************************************/
57
50
  var __webpack_exports__ = {};
@@ -1 +1 @@
1
- {"version":3,"file":"browserslistToSwc.js","sources":["webpack://@workleap/swc-configs/./src/browserslistToSwc.ts"],"sourcesContent":["// Inspired by https://github.com/marcofugaro/browserslist-to-esbuild/blob/main/src/index.js.\n//\n// This function exist because browserslist-rs (which is used under the hood by SWC) doesn't support browserslist \"extends\" syntax: https://github.com/browserslist/browserslist-rs#limitations.\n// Therefore, we must parse ourself the \".browserslistrc\" file to extract the browser entries and transform them into valid SWC \"env.targets\".\n//\n// The function will convert an array of browserslist entries from:\n//\n// ['and_chr 115', 'and_ff 115', 'and_qq 13.1',\n// 'and_uc 15.5', 'android 115', 'baidu 13.18',\n// 'bb 10', 'bb 7', 'chrome 116',\n// 'chrome 115', 'chrome 114', 'chrome 113',\n// 'chrome 112', 'chrome 111', 'chrome 110',\n// 'chrome 109', 'chrome 108', 'chrome 107',\n// 'edge 115', 'edge 114', 'edge 113',\n// 'edge 112', 'edge 111', 'edge 110',\n// 'edge 109', 'edge 108', 'edge 107',\n// 'edge 106', 'firefox 116', 'firefox 115',\n// 'firefox 114', 'firefox 113', 'firefox 112',\n// 'firefox 111', 'firefox 110', 'firefox 109',\n// 'firefox 108', 'firefox 107', 'ie 11',\n// 'ie 10', 'ie 9', 'ie 8',\n// 'ie 7', 'ie 6', 'ie 5.5',\n// 'ie_mob 11', 'ie_mob 10', 'ios_saf 16.5',\n// 'ios_saf 16.4', 'ios_saf 16.3', 'ios_saf 16.2',\n// 'ios_saf 16.1', 'ios_saf 16.0', 'ios_saf 15.6-15.7',\n// 'ios_saf 15.5', 'ios_saf 15.4', 'ios_saf 15.2-15.3',\n// 'kaios 3.0-3.1', 'kaios 2.5', 'op_mini all',\n// 'op_mob 73', 'opera 101', 'opera 100',\n// 'opera 99', 'opera 98', 'opera 97',\n// 'opera 96', 'opera 95', 'opera 94',\n// 'opera 93', 'opera 92', 'safari 16.5',\n// 'safari 16.4', 'safari 16.3', 'safari 16.2',\n// 'safari 16.1', 'safari 16.0', 'safari 15.6',\n// 'safari 15.5', 'safari 15.4', 'safari 15.2-15.3',\n// 'samsung 21', 'samsung 20', 'samsung 19.0',\n// 'samsung 18.0', 'samsung 17.0', 'samsung 16.0',\n// 'samsung 15.0', 'samsung 14.0', 'samsung 13.0',\n// 'samsung 12.0']\n//\n// To an object literal of SWC \"env.targets\":\n//\n// {\n// chrome: '107',\n// firefox: '107',\n// android: '115',\n// edge: '106',\n// ie: '5.5',\n// opera: '73',\n// safari: '15.2',\n// samsung: '12'\n// }\n\nimport browserslist from \"browserslist\";\n\n// Original browserslist-rs supported browsers (https://github.com/browserslist/browserslist-rs/blob/99a3244fc8c0e631a80a9cae5c41dca6c5a2aae5/build.rs#L10)\n// minus the browsers that are discarted by SWC (https://github.com/swc-project/swc/blob/main/crates/preset_env_base/src/lib.rs#L105).\nconst SwcSupportedBrowsers = [\n \"ie\",\n \"edge\",\n \"firefox\",\n \"chrome\",\n \"safari\",\n \"opera\",\n \"ios\",\n \"android\",\n \"op_mob\",\n \"and_chr\",\n \"and_ff\",\n \"ie_mob\",\n \"samsung\"\n] as const;\n\n// SWC browsers aliases (https://github.com/swc-project/swc/blob/main/crates/preset_env_base/src/lib.rs#L90).\nconst SwcMobileBrowserAliases: Record<string, string> = {\n \"and_chr\": \"chrome\",\n \"and_ff\": \"firefox\",\n \"ie_mob\": \"ie\",\n \"ios_saf\": \"ios\",\n \"op_mob\": \"opera\"\n};\n\nfunction parseBrowserslistEntry(entry: string) {\n // \"chrome 11\" --> [\"chrome\", \"11\"]\n const values = entry.split(\" \");\n\n let browser = values[0];\n let version = values[1];\n\n // \"and_chr\" --> \"chrome\"\n if (SwcMobileBrowserAliases[browser]) {\n browser = SwcMobileBrowserAliases[browser];\n }\n\n // \"11.0-12.0\" --> \"11.0\"\n if (version.includes(\"-\")) {\n version = version.slice(0, version.indexOf(\"-\"));\n }\n\n // \"11.0\" --> \"11\"\n if (version.endsWith(\".0\")) {\n version = version.slice(0, -2);\n }\n\n return {\n browser,\n version\n };\n}\n\nexport function createSwcTargetsFromBrowserslistEntries(entries: string[]) {\n return entries.reduce((acc, x: string) => {\n const { browser, version } = parseBrowserslistEntry(x);\n\n // Exclude browsers that are not supported by SWC.\n if (((SwcSupportedBrowsers as unknown) as string[]).indexOf(browser) === -1) {\n return acc;\n }\n\n // Let's make TS happy as we are now certain that the browser is part\n // of the supported browsers list.\n const _browser = browser as keyof typeof SwcSupportedBrowsers;\n\n // SWC \"env.targets\" only support a single entry per target (browser).\n // Therefore, we loop through the browser versions to keep only the oldest one.\n if (acc[_browser]) {\n if (parseFloat(acc[_browser]) > parseFloat(version)) {\n acc[_browser] = version;\n }\n } else {\n acc[_browser] = version;\n }\n\n return acc;\n }, {} as Record<keyof typeof SwcSupportedBrowsers, string>);\n}\n\nexport interface BrowserslistToSwcOptions extends Omit<browserslist.Options, \"path\"> {\n queries?: string | string[];\n}\n\nexport function browserslistToSwc(options: BrowserslistToSwcOptions = {}) {\n const {\n queries,\n ...browserlistsOptions\n } = options;\n\n // Will return the entries matching the \"queries\" prop when provided, otherwise,\n // the function will load the closest \".browserslistrc\" file.\n const entries = browserslist(queries, {\n path: \"./browserslistrc\",\n ...browserlistsOptions\n });\n\n return createSwcTargetsFromBrowserslistEntries(entries);\n}\n"],"names":["browserslist","SwcSupportedBrowsers","SwcMobileBrowserAliases","parseBrowserslistEntry","entry","values","browser","version","createSwcTargetsFromBrowserslistEntries","entries","acc","x","_browser","parseFloat","browserslistToSwc","options","queries","browserlistsOptions"],"mappings":"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"}
1
+ {"version":3,"file":"browserslistToSwc.js","sources":["webpack://@workleap/swc-configs/./src/browserslistToSwc.ts"],"sourcesContent":["// Inspired by https://github.com/marcofugaro/browserslist-to-esbuild/blob/main/src/index.js.\n//\n// This function exist because browserslist-rs (which is used under the hood by SWC) doesn't support browserslist \"extends\" syntax: https://github.com/browserslist/browserslist-rs#limitations.\n// Therefore, we must parse ourself the \".browserslistrc\" file to extract the browser entries and transform them into valid SWC \"env.targets\".\n//\n// The function will convert an array of browserslist entries from:\n//\n// ['and_chr 115', 'and_ff 115', 'and_qq 13.1',\n// 'and_uc 15.5', 'android 115', 'baidu 13.18',\n// 'bb 10', 'bb 7', 'chrome 116',\n// 'chrome 115', 'chrome 114', 'chrome 113',\n// 'chrome 112', 'chrome 111', 'chrome 110',\n// 'chrome 109', 'chrome 108', 'chrome 107',\n// 'edge 115', 'edge 114', 'edge 113',\n// 'edge 112', 'edge 111', 'edge 110',\n// 'edge 109', 'edge 108', 'edge 107',\n// 'edge 106', 'firefox 116', 'firefox 115',\n// 'firefox 114', 'firefox 113', 'firefox 112',\n// 'firefox 111', 'firefox 110', 'firefox 109',\n// 'firefox 108', 'firefox 107', 'ie 11',\n// 'ie 10', 'ie 9', 'ie 8',\n// 'ie 7', 'ie 6', 'ie 5.5',\n// 'ie_mob 11', 'ie_mob 10', 'ios_saf 16.5',\n// 'ios_saf 16.4', 'ios_saf 16.3', 'ios_saf 16.2',\n// 'ios_saf 16.1', 'ios_saf 16.0', 'ios_saf 15.6-15.7',\n// 'ios_saf 15.5', 'ios_saf 15.4', 'ios_saf 15.2-15.3',\n// 'kaios 3.0-3.1', 'kaios 2.5', 'op_mini all',\n// 'op_mob 73', 'opera 101', 'opera 100',\n// 'opera 99', 'opera 98', 'opera 97',\n// 'opera 96', 'opera 95', 'opera 94',\n// 'opera 93', 'opera 92', 'safari 16.5',\n// 'safari 16.4', 'safari 16.3', 'safari 16.2',\n// 'safari 16.1', 'safari 16.0', 'safari 15.6',\n// 'safari 15.5', 'safari 15.4', 'safari 15.2-15.3',\n// 'samsung 21', 'samsung 20', 'samsung 19.0',\n// 'samsung 18.0', 'samsung 17.0', 'samsung 16.0',\n// 'samsung 15.0', 'samsung 14.0', 'samsung 13.0',\n// 'samsung 12.0']\n//\n// To an object literal of SWC \"env.targets\":\n//\n// {\n// chrome: '107',\n// firefox: '107',\n// android: '115',\n// edge: '106',\n// ie: '5.5',\n// opera: '73',\n// safari: '15.2',\n// samsung: '12'\n// }\n\nimport browserslist from \"browserslist\";\n\n// Original browserslist-rs supported browsers (https://github.com/browserslist/browserslist-rs/blob/99a3244fc8c0e631a80a9cae5c41dca6c5a2aae5/build.rs#L10)\n// minus the browsers that are discarted by SWC (https://github.com/swc-project/swc/blob/main/crates/preset_env_base/src/lib.rs#L105).\nconst SwcSupportedBrowsers = [\n \"ie\",\n \"edge\",\n \"firefox\",\n \"chrome\",\n \"safari\",\n \"opera\",\n \"ios\",\n \"android\",\n \"op_mob\",\n \"and_chr\",\n \"and_ff\",\n \"ie_mob\",\n \"samsung\"\n] as const;\n\n// SWC browsers aliases (https://github.com/swc-project/swc/blob/main/crates/preset_env_base/src/lib.rs#L90).\nconst SwcMobileBrowserAliases: Record<string, string> = {\n \"and_chr\": \"chrome\",\n \"and_ff\": \"firefox\",\n \"ie_mob\": \"ie\",\n \"ios_saf\": \"ios\",\n \"op_mob\": \"opera\"\n};\n\nfunction parseBrowserslistEntry(entry: string) {\n // \"chrome 11\" --> [\"chrome\", \"11\"]\n const values = entry.split(\" \");\n\n let browser = values[0];\n let version = values[1];\n\n // \"and_chr\" --> \"chrome\"\n if (SwcMobileBrowserAliases[browser]) {\n browser = SwcMobileBrowserAliases[browser];\n }\n\n // \"11.0-12.0\" --> \"11.0\"\n if (version.includes(\"-\")) {\n version = version.slice(0, version.indexOf(\"-\"));\n }\n\n // \"11.0\" --> \"11\"\n if (version.endsWith(\".0\")) {\n version = version.slice(0, -2);\n }\n\n return {\n browser,\n version\n };\n}\n\nexport function createSwcTargetsFromBrowserslistEntries(entries: string[]) {\n return entries.reduce((acc, x: string) => {\n const { browser, version } = parseBrowserslistEntry(x);\n\n // Exclude browsers that are not supported by SWC.\n if (((SwcSupportedBrowsers as unknown) as string[]).indexOf(browser) === -1) {\n return acc;\n }\n\n // Let's make TS happy as we are now certain that the browser is part\n // of the supported browsers list.\n const _browser = browser as keyof typeof SwcSupportedBrowsers;\n\n // SWC \"env.targets\" only support a single entry per target (browser).\n // Therefore, we loop through the browser versions to keep only the oldest one.\n if (acc[_browser]) {\n if (parseFloat(acc[_browser]) > parseFloat(version)) {\n acc[_browser] = version;\n }\n } else {\n acc[_browser] = version;\n }\n\n return acc;\n }, {} as Record<keyof typeof SwcSupportedBrowsers, string>);\n}\n\nexport interface BrowserslistToSwcOptions extends Omit<browserslist.Options, \"path\"> {\n queries?: string | string[];\n}\n\nexport function browserslistToSwc(options: BrowserslistToSwcOptions = {}) {\n const {\n queries,\n ...browserlistsOptions\n } = options;\n\n // Will return the entries matching the \"queries\" prop when provided, otherwise,\n // the function will load the closest \".browserslistrc\" file.\n const entries = browserslist(queries, {\n path: \"./browserslistrc\",\n ...browserlistsOptions\n });\n\n return createSwcTargetsFromBrowserslistEntries(entries);\n}\n"],"names":["browserslist","SwcSupportedBrowsers","SwcMobileBrowserAliases","parseBrowserslistEntry","entry","values","browser","version","createSwcTargetsFromBrowserslistEntries","entries","acc","x","_browser","parseFloat","browserslistToSwc","options","queries","browserlistsOptions"],"mappings":"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"}
package/dist/build.js CHANGED
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
12
12
  /************************************************************************/
13
13
  // webpack/runtime/define_property_getters
14
14
  (() => {
15
- __webpack_require__.d = function(exports, definition) {
15
+ __webpack_require__.d = (exports, definition) => {
16
16
  for(var key in definition) {
17
17
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
18
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -22,21 +22,17 @@ __webpack_require__.d = function(exports, definition) {
22
22
  })();
23
23
  // webpack/runtime/has_own_property
24
24
  (() => {
25
- __webpack_require__.o = function (obj, prop) {
26
- return Object.prototype.hasOwnProperty.call(obj, prop);
27
- };
28
-
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
26
  })();
30
27
  // webpack/runtime/make_namespace_object
31
28
  (() => {
32
29
  // define __esModule on exports
33
- __webpack_require__.r = function(exports) {
30
+ __webpack_require__.r = (exports) => {
34
31
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
32
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
33
  }
37
34
  Object.defineProperty(exports, '__esModule', { value: true });
38
35
  };
39
-
40
36
  })();
41
37
  /************************************************************************/
42
38
  var __webpack_exports__ = {};
package/dist/build.js.map CHANGED
@@ -1 +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"}
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/dev.js CHANGED
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
12
12
  /************************************************************************/
13
13
  // webpack/runtime/define_property_getters
14
14
  (() => {
15
- __webpack_require__.d = function(exports, definition) {
15
+ __webpack_require__.d = (exports, definition) => {
16
16
  for(var key in definition) {
17
17
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
18
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -22,21 +22,17 @@ __webpack_require__.d = function(exports, definition) {
22
22
  })();
23
23
  // webpack/runtime/has_own_property
24
24
  (() => {
25
- __webpack_require__.o = function (obj, prop) {
26
- return Object.prototype.hasOwnProperty.call(obj, prop);
27
- };
28
-
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
26
  })();
30
27
  // webpack/runtime/make_namespace_object
31
28
  (() => {
32
29
  // define __esModule on exports
33
- __webpack_require__.r = function(exports) {
30
+ __webpack_require__.r = (exports) => {
34
31
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
32
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
33
  }
37
34
  Object.defineProperty(exports, '__esModule', { value: true });
38
35
  };
39
-
40
36
  })();
41
37
  /************************************************************************/
42
38
  var __webpack_exports__ = {};
package/dist/dev.js.map CHANGED
@@ -1 +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"}
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/index.js CHANGED
@@ -53,21 +53,18 @@ return module.exports;
53
53
  // webpack/runtime/compat_get_default_export
54
54
  (() => {
55
55
  // getDefaultExport function for compatibility with non-ESM modules
56
- __webpack_require__.n = function (module) {
56
+ __webpack_require__.n = (module) => {
57
57
  var getter = module && module.__esModule ?
58
- function () { return module['default']; } :
59
- function () { return module; };
58
+ () => (module['default']) :
59
+ () => (module);
60
60
  __webpack_require__.d(getter, { a: getter });
61
61
  return getter;
62
62
  };
63
63
 
64
-
65
-
66
-
67
64
  })();
68
65
  // webpack/runtime/define_property_getters
69
66
  (() => {
70
- __webpack_require__.d = function(exports, definition) {
67
+ __webpack_require__.d = (exports, definition) => {
71
68
  for(var key in definition) {
72
69
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
73
70
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -77,21 +74,17 @@ __webpack_require__.d = function(exports, definition) {
77
74
  })();
78
75
  // webpack/runtime/has_own_property
79
76
  (() => {
80
- __webpack_require__.o = function (obj, prop) {
81
- return Object.prototype.hasOwnProperty.call(obj, prop);
82
- };
83
-
77
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
84
78
  })();
85
79
  // webpack/runtime/make_namespace_object
86
80
  (() => {
87
81
  // define __esModule on exports
88
- __webpack_require__.r = function(exports) {
82
+ __webpack_require__.r = (exports) => {
89
83
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
90
84
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
91
85
  }
92
86
  Object.defineProperty(exports, '__esModule', { value: true });
93
87
  };
94
-
95
88
  })();
96
89
  /************************************************************************/
97
90
  var __webpack_exports__ = {};
package/dist/index.js.map CHANGED
@@ -1 +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"}
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/jest.js CHANGED
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
12
12
  /************************************************************************/
13
13
  // webpack/runtime/define_property_getters
14
14
  (() => {
15
- __webpack_require__.d = function(exports, definition) {
15
+ __webpack_require__.d = (exports, definition) => {
16
16
  for(var key in definition) {
17
17
  if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
18
  Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
@@ -22,21 +22,17 @@ __webpack_require__.d = function(exports, definition) {
22
22
  })();
23
23
  // webpack/runtime/has_own_property
24
24
  (() => {
25
- __webpack_require__.o = function (obj, prop) {
26
- return Object.prototype.hasOwnProperty.call(obj, prop);
27
- };
28
-
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
26
  })();
30
27
  // webpack/runtime/make_namespace_object
31
28
  (() => {
32
29
  // define __esModule on exports
33
- __webpack_require__.r = function(exports) {
30
+ __webpack_require__.r = (exports) => {
34
31
  if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
32
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
33
  }
37
34
  Object.defineProperty(exports, '__esModule', { value: true });
38
35
  };
39
-
40
36
  })();
41
37
  /************************************************************************/
42
38
  var __webpack_exports__ = {};
package/dist/jest.js.map CHANGED
@@ -1 +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"}
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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workleap/swc-configs",
3
3
  "description": "Workleap recommended SWC configurations.",
4
- "version": "2.2.4",
4
+ "version": "2.2.5",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "git+https://github.com/gsoft-inc/wl-web-configs.git",
31
+ "url": "git+https://github.com/workleap/wl-web-configs.git",
32
32
  "directory": "packages/swc-configs"
33
33
  },
34
34
  "peerDependencies": {
@@ -46,25 +46,23 @@
46
46
  }
47
47
  },
48
48
  "devDependencies": {
49
- "@rsbuild/core": "1.1.13",
50
- "@rslib/core": "0.3.1",
51
- "@swc/core": "1.10.7",
49
+ "@rsbuild/core": "1.2.19",
50
+ "@rslib/core": "0.5.4",
51
+ "@swc/core": "1.11.11",
52
52
  "@swc/helpers": "0.5.15",
53
53
  "@swc/jest": "0.2.37",
54
- "@types/jest": "29.5.14",
55
- "@typescript-eslint/parser": "8.20.0",
54
+ "@typescript-eslint/parser": "8.26.1",
56
55
  "eslint": "8.57.0",
57
- "jest": "29.7.0",
58
- "ts-node": "10.9.2",
59
- "typescript": "5.5.4",
60
- "@workleap/eslint-plugin": "3.2.6",
61
- "@workleap/typescript-configs": "3.0.2",
62
- "@workleap/rslib-configs": "1.0.2"
56
+ "typescript": "5.8.2",
57
+ "vitest": "3.0.9",
58
+ "@workleap/eslint-plugin": "3.3.1",
59
+ "@workleap/rslib-configs": "1.0.3",
60
+ "@workleap/typescript-configs": "3.0.2"
63
61
  },
64
62
  "scripts": {
65
63
  "build": "rslib build -c rslib.config.ts",
66
64
  "eslint": "eslint . --max-warnings=-0 --cache --cache-location node_modules/.cache/eslint",
67
65
  "typecheck": "tsc",
68
- "test": "jest"
66
+ "test": "vitest --config vitest.config.ts --no-watch"
69
67
  }
70
68
  }