@unpackjs/core 2.4.0 → 2.4.2

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 (195) hide show
  1. package/dist/index.cjs +2028 -196
  2. package/dist/index.js +1876 -39
  3. package/dist/lightningcssLoader.mjs +18 -0
  4. package/dist/typedCssModulesLoader.mjs +139 -0
  5. package/{dist → dist-types}/bundler-config/cache.d.ts +1 -1
  6. package/dist-types/bundler-config/cache.d.ts.map +1 -0
  7. package/{dist → dist-types}/bundler-config/chunkSplit.d.ts +1 -1
  8. package/dist-types/bundler-config/chunkSplit.d.ts.map +1 -0
  9. package/{dist → dist-types}/bundler-config/css.d.ts +1 -1
  10. package/dist-types/bundler-config/css.d.ts.map +1 -0
  11. package/{dist → dist-types}/bundler-config/experimentCss.d.ts +1 -1
  12. package/dist-types/bundler-config/experimentCss.d.ts.map +1 -0
  13. package/{dist → dist-types}/bundler-config/index.d.ts +1 -1
  14. package/dist-types/bundler-config/index.d.ts.map +1 -0
  15. package/{dist/lightningcss/loader.d.ts → dist-types/bundler-config/loaders/lightningcssLoader.d.ts} +2 -2
  16. package/dist-types/bundler-config/loaders/lightningcssLoader.d.ts.map +1 -0
  17. package/dist-types/bundler-config/loaders/typedCssModulesLoader.d.ts +6 -0
  18. package/dist-types/bundler-config/loaders/typedCssModulesLoader.d.ts.map +1 -0
  19. package/{dist/bundler-config → dist-types/bundler-config/plugins}/jsMinify.d.ts +1 -1
  20. package/dist-types/bundler-config/plugins/jsMinify.d.ts.map +1 -0
  21. package/{dist/lightningcss/minimizer.d.ts → dist-types/bundler-config/plugins/lightningcssMinify.d.ts} +2 -3
  22. package/dist-types/bundler-config/plugins/lightningcssMinify.d.ts.map +1 -0
  23. package/{dist/bundler-config/oxlint/plugin.d.ts → dist-types/bundler-config/plugins/oxlint/index.d.ts} +1 -1
  24. package/dist-types/bundler-config/plugins/oxlint/index.d.ts.map +1 -0
  25. package/dist-types/bundler-config/plugins/progress/helpers.d.ts.map +1 -0
  26. package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/rspack.d.ts +1 -1
  27. package/dist-types/bundler-config/plugins/progress/rspack.d.ts.map +1 -0
  28. package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/webpack.d.ts +1 -1
  29. package/dist-types/bundler-config/plugins/progress/webpack.d.ts.map +1 -0
  30. package/{dist/typed-css-modules/plugin.d.ts → dist-types/bundler-config/plugins/typedCssModules.d.ts} +2 -2
  31. package/dist-types/bundler-config/plugins/typedCssModules.d.ts.map +1 -0
  32. package/{dist → dist-types}/config.d.ts +1 -1
  33. package/dist-types/config.d.ts.map +1 -0
  34. package/{dist → dist-types}/createUnpack.d.ts +1 -1
  35. package/{dist → dist-types}/createUnpack.d.ts.map +1 -1
  36. package/{dist → dist-types}/index.d.ts +1 -1
  37. package/{dist → dist-types}/index.d.ts.map +1 -1
  38. package/dist-types/logger.d.ts +3 -0
  39. package/{dist → dist-types}/logger.d.ts.map +1 -1
  40. package/{dist → dist-types}/plugin.d.ts +1 -1
  41. package/{dist → dist-types}/plugin.d.ts.map +1 -1
  42. package/dist-types/run/build.d.ts +3 -0
  43. package/{dist → dist-types}/run/build.d.ts.map +1 -1
  44. package/{dist → dist-types}/run/dev.d.ts +1 -1
  45. package/{dist → dist-types}/run/dev.d.ts.map +1 -1
  46. package/{dist → dist-types}/types/config.d.ts +1 -1
  47. package/{dist → dist-types}/types/config.d.ts.map +1 -1
  48. package/{dist → dist-types}/types/index.d.ts +1 -0
  49. package/{dist → dist-types}/types/index.d.ts.map +1 -1
  50. package/{dist → dist-types}/utils.d.ts +5 -1
  51. package/dist-types/utils.d.ts.map +1 -0
  52. package/package.json +6 -37
  53. package/dist/bundler-config/cache.cjs +0 -114
  54. package/dist/bundler-config/cache.d.ts.map +0 -1
  55. package/dist/bundler-config/cache.js +0 -72
  56. package/dist/bundler-config/chunkSplit.cjs +0 -192
  57. package/dist/bundler-config/chunkSplit.d.ts.map +0 -1
  58. package/dist/bundler-config/chunkSplit.js +0 -150
  59. package/dist/bundler-config/css.cjs +0 -189
  60. package/dist/bundler-config/css.d.ts.map +0 -1
  61. package/dist/bundler-config/css.js +0 -149
  62. package/dist/bundler-config/experimentCss.cjs +0 -214
  63. package/dist/bundler-config/experimentCss.d.ts.map +0 -1
  64. package/dist/bundler-config/experimentCss.js +0 -175
  65. package/dist/bundler-config/helpers.cjs +0 -77
  66. package/dist/bundler-config/helpers.js +0 -31
  67. package/dist/bundler-config/index.cjs +0 -309
  68. package/dist/bundler-config/index.d.ts.map +0 -1
  69. package/dist/bundler-config/index.js +0 -262
  70. package/dist/bundler-config/jsMinify.cjs +0 -113
  71. package/dist/bundler-config/jsMinify.d.ts.map +0 -1
  72. package/dist/bundler-config/jsMinify.js +0 -71
  73. package/dist/bundler-config/oxlint/plugin.cjs +0 -143
  74. package/dist/bundler-config/oxlint/plugin.d.ts.map +0 -1
  75. package/dist/bundler-config/oxlint/plugin.js +0 -104
  76. package/dist/bundler-config/progress/helpers.cjs +0 -126
  77. package/dist/bundler-config/progress/helpers.d.ts.map +0 -1
  78. package/dist/bundler-config/progress/helpers.js +0 -81
  79. package/dist/bundler-config/progress/rspack.cjs +0 -70
  80. package/dist/bundler-config/progress/rspack.d.ts.map +0 -1
  81. package/dist/bundler-config/progress/rspack.js +0 -38
  82. package/dist/bundler-config/progress/webpack.cjs +0 -87
  83. package/dist/bundler-config/progress/webpack.d.ts.map +0 -1
  84. package/dist/bundler-config/progress/webpack.js +0 -45
  85. package/dist/colors.cjs +0 -82
  86. package/dist/colors.js +0 -40
  87. package/dist/config.cjs +0 -148
  88. package/dist/config.d.ts.map +0 -1
  89. package/dist/config.js +0 -101
  90. package/dist/constants.cjs +0 -122
  91. package/dist/constants.js +0 -51
  92. package/dist/createUnpack.cjs +0 -107
  93. package/dist/createUnpack.js +0 -75
  94. package/dist/fs.cjs +0 -91
  95. package/dist/fs.js +0 -34
  96. package/dist/global.cjs +0 -36
  97. package/dist/global.js +0 -4
  98. package/dist/lightningcss/loader.cjs +0 -57
  99. package/dist/lightningcss/loader.d.ts.map +0 -1
  100. package/dist/lightningcss/loader.js +0 -25
  101. package/dist/lightningcss/minimizer.cjs +0 -94
  102. package/dist/lightningcss/minimizer.d.ts.map +0 -1
  103. package/dist/lightningcss/minimizer.js +0 -59
  104. package/dist/loadEnv.cjs +0 -122
  105. package/dist/loadEnv.js +0 -80
  106. package/dist/loadingAnimation.cjs +0 -76
  107. package/dist/loadingAnimation.js +0 -44
  108. package/dist/logger.cjs +0 -116
  109. package/dist/logger.d.ts +0 -3
  110. package/dist/logger.js +0 -74
  111. package/dist/openBrowser.cjs +0 -89
  112. package/dist/openBrowser.js +0 -49
  113. package/dist/plugin.cjs +0 -42
  114. package/dist/plugin.js +0 -10
  115. package/dist/prebundleDeps.cjs +0 -349
  116. package/dist/prebundleDeps.js +0 -303
  117. package/dist/progressBar.cjs +0 -66
  118. package/dist/progressBar.js +0 -34
  119. package/dist/reporter.cjs +0 -164
  120. package/dist/reporter.js +0 -120
  121. package/dist/run/build.cjs +0 -68
  122. package/dist/run/build.d.ts +0 -3
  123. package/dist/run/build.js +0 -26
  124. package/dist/run/dev.cjs +0 -118
  125. package/dist/run/dev.js +0 -75
  126. package/dist/run/index.cjs +0 -69
  127. package/dist/run/index.js +0 -4
  128. package/dist/typed-css-modules/loader.cjs +0 -141
  129. package/dist/typed-css-modules/loader.d.ts +0 -8
  130. package/dist/typed-css-modules/loader.d.ts.map +0 -1
  131. package/dist/typed-css-modules/loader.js +0 -92
  132. package/dist/typed-css-modules/plugin.cjs +0 -117
  133. package/dist/typed-css-modules/plugin.d.ts.map +0 -1
  134. package/dist/typed-css-modules/plugin.js +0 -74
  135. package/dist/typed-css-modules/utils.cjs +0 -46
  136. package/dist/typed-css-modules/utils.d.ts +0 -6
  137. package/dist/typed-css-modules/utils.d.ts.map +0 -1
  138. package/dist/typed-css-modules/utils.js +0 -14
  139. package/dist/types/chunkSplit.cjs +0 -18
  140. package/dist/types/chunkSplit.js +0 -2
  141. package/dist/types/config.cjs +0 -18
  142. package/dist/types/config.js +0 -2
  143. package/dist/types/index.cjs +0 -96
  144. package/dist/types/index.js +0 -7
  145. package/dist/types/lightningcss.cjs +0 -18
  146. package/dist/types/lightningcss.js +0 -2
  147. package/dist/types/logger.cjs +0 -45
  148. package/dist/types/logger.js +0 -13
  149. package/dist/types/oxc.cjs +0 -18
  150. package/dist/types/oxc.js +0 -2
  151. package/dist/types/plugin.cjs +0 -18
  152. package/dist/types/plugin.js +0 -2
  153. package/dist/utils.cjs +0 -346
  154. package/dist/utils.d.ts.map +0 -1
  155. package/dist/utils.js +0 -204
  156. package/dist/watchFiles.cjs +0 -69
  157. package/dist/watchFiles.js +0 -27
  158. /package/dist/{bundler-config/oxlint/.oxlintrc.json → .oxlintrc.json} +0 -0
  159. /package/{dist → dist-types}/bundler-config/helpers.d.ts +0 -0
  160. /package/{dist → dist-types}/bundler-config/helpers.d.ts.map +0 -0
  161. /package/{dist/bundler-config → dist-types/bundler-config/plugins}/progress/helpers.d.ts +0 -0
  162. /package/{dist → dist-types}/colors.d.ts +0 -0
  163. /package/{dist → dist-types}/colors.d.ts.map +0 -0
  164. /package/{dist → dist-types}/constants.d.ts +0 -0
  165. /package/{dist → dist-types}/constants.d.ts.map +0 -0
  166. /package/{dist → dist-types}/fs.d.ts +0 -0
  167. /package/{dist → dist-types}/fs.d.ts.map +0 -0
  168. /package/{dist → dist-types}/global.d.ts +0 -0
  169. /package/{dist → dist-types}/global.d.ts.map +0 -0
  170. /package/{dist → dist-types}/loadEnv.d.ts +0 -0
  171. /package/{dist → dist-types}/loadEnv.d.ts.map +0 -0
  172. /package/{dist → dist-types}/loadingAnimation.d.ts +0 -0
  173. /package/{dist → dist-types}/loadingAnimation.d.ts.map +0 -0
  174. /package/{dist → dist-types}/openBrowser.d.ts +0 -0
  175. /package/{dist → dist-types}/openBrowser.d.ts.map +0 -0
  176. /package/{dist → dist-types}/prebundleDeps.d.ts +0 -0
  177. /package/{dist → dist-types}/prebundleDeps.d.ts.map +0 -0
  178. /package/{dist → dist-types}/progressBar.d.ts +0 -0
  179. /package/{dist → dist-types}/progressBar.d.ts.map +0 -0
  180. /package/{dist → dist-types}/reporter.d.ts +0 -0
  181. /package/{dist → dist-types}/reporter.d.ts.map +0 -0
  182. /package/{dist → dist-types}/run/index.d.ts +0 -0
  183. /package/{dist → dist-types}/run/index.d.ts.map +0 -0
  184. /package/{dist → dist-types}/types/chunkSplit.d.ts +0 -0
  185. /package/{dist → dist-types}/types/chunkSplit.d.ts.map +0 -0
  186. /package/{dist → dist-types}/types/lightningcss.d.ts +0 -0
  187. /package/{dist → dist-types}/types/lightningcss.d.ts.map +0 -0
  188. /package/{dist → dist-types}/types/logger.d.ts +0 -0
  189. /package/{dist → dist-types}/types/logger.d.ts.map +0 -0
  190. /package/{dist → dist-types}/types/oxc.d.ts +0 -0
  191. /package/{dist → dist-types}/types/oxc.d.ts.map +0 -0
  192. /package/{dist → dist-types}/types/plugin.d.ts +0 -0
  193. /package/{dist → dist-types}/types/plugin.d.ts.map +0 -0
  194. /package/{dist → dist-types}/watchFiles.d.ts +0 -0
  195. /package/{dist → dist-types}/watchFiles.d.ts.map +0 -0
package/dist/fs.cjs DELETED
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- isFileSync: ()=>isFileSync,
37
- pathExists: ()=>pathExists,
38
- removeDir: ()=>removeDir,
39
- isEmptyDir: ()=>isEmptyDir,
40
- isFileExists: ()=>isFileExists,
41
- findExists: ()=>findExists
42
- });
43
- const external_node_fs_namespaceObject = require("node:fs");
44
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
45
- const isFileSync = (filePath)=>{
46
- try {
47
- var _fs_statSync;
48
- return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
49
- throwIfNoEntry: false
50
- })) ? void 0 : _fs_statSync.isFile();
51
- } catch (_) {
52
- return false;
53
- }
54
- };
55
- function isEmptyDir(path) {
56
- const files = external_node_fs_default().readdirSync(path);
57
- return 0 === files.length || 1 === files.length && '.git' === files[0];
58
- }
59
- const findExists = (files)=>{
60
- for (const file of files)if (isFileSync(file)) return file;
61
- return false;
62
- };
63
- async function pathExists(path) {
64
- return external_node_fs_default().promises.access(path).then(()=>true).catch(()=>false);
65
- }
66
- async function isFileExists(file) {
67
- return external_node_fs_default().promises.access(file, external_node_fs_default().constants.F_OK).then(()=>true).catch(()=>false);
68
- }
69
- const removeDir = (dir)=>{
70
- external_node_fs_default().rmSync(dir, {
71
- recursive: true,
72
- force: true
73
- });
74
- };
75
- exports.findExists = __webpack_exports__.findExists;
76
- exports.isEmptyDir = __webpack_exports__.isEmptyDir;
77
- exports.isFileExists = __webpack_exports__.isFileExists;
78
- exports.isFileSync = __webpack_exports__.isFileSync;
79
- exports.pathExists = __webpack_exports__.pathExists;
80
- exports.removeDir = __webpack_exports__.removeDir;
81
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
82
- "findExists",
83
- "isEmptyDir",
84
- "isFileExists",
85
- "isFileSync",
86
- "pathExists",
87
- "removeDir"
88
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
89
- Object.defineProperty(exports, '__esModule', {
90
- value: true
91
- });
package/dist/fs.js DELETED
@@ -1,34 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import node_fs from "node:fs";
4
- const isFileSync = (filePath)=>{
5
- try {
6
- var _fs_statSync;
7
- return null == (_fs_statSync = node_fs.statSync(filePath, {
8
- throwIfNoEntry: false
9
- })) ? void 0 : _fs_statSync.isFile();
10
- } catch (_) {
11
- return false;
12
- }
13
- };
14
- function isEmptyDir(path) {
15
- const files = node_fs.readdirSync(path);
16
- return 0 === files.length || 1 === files.length && '.git' === files[0];
17
- }
18
- const findExists = (files)=>{
19
- for (const file of files)if (isFileSync(file)) return file;
20
- return false;
21
- };
22
- async function pathExists(path) {
23
- return node_fs.promises.access(path).then(()=>true).catch(()=>false);
24
- }
25
- async function isFileExists(file) {
26
- return node_fs.promises.access(file, node_fs.constants.F_OK).then(()=>true).catch(()=>false);
27
- }
28
- const removeDir = (dir)=>{
29
- node_fs.rmSync(dir, {
30
- recursive: true,
31
- force: true
32
- });
33
- };
34
- export { findExists, isEmptyDir, isFileExists, isFileSync, pathExists, removeDir };
package/dist/global.cjs DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- restartCleaners: ()=>restartCleaners
28
- });
29
- const restartCleaners = [];
30
- exports.restartCleaners = __webpack_exports__.restartCleaners;
31
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
- "restartCleaners"
33
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
34
- Object.defineProperty(exports, '__esModule', {
35
- value: true
36
- });
package/dist/global.js DELETED
@@ -1,4 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- const restartCleaners = [];
4
- export { restartCleaners };
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- default: ()=>loader
28
- });
29
- const external_node_buffer_namespaceObject = require("node:buffer");
30
- const external_lightningcss_namespaceObject = require("lightningcss");
31
- async function LightningcssLoader(source, prevSourceMap) {
32
- const done = this.async();
33
- const options = this.getOptions();
34
- const { implementation, sourceMap, ...opts } = options;
35
- const transform = (null == implementation ? void 0 : implementation.transform) ?? external_lightningcss_namespaceObject.transform;
36
- try {
37
- const { code, map } = transform({
38
- filename: this.resourcePath,
39
- code: external_node_buffer_namespaceObject.Buffer.from(source),
40
- sourceMap,
41
- inputSourceMap: sourceMap && prevSourceMap ? JSON.stringify(prevSourceMap) : void 0,
42
- ...opts
43
- });
44
- const codeAsString = code.toString();
45
- done(null, codeAsString, map && JSON.parse(map.toString()));
46
- } catch (error) {
47
- done(error);
48
- }
49
- }
50
- const loader = LightningcssLoader;
51
- exports["default"] = __webpack_exports__["default"];
52
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
53
- "default"
54
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
55
- Object.defineProperty(exports, '__esModule', {
56
- value: true
57
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/lightningcss/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,iBAAe,kBAAkB,CAC/B,IAAI,EAAE,aAAa,CAAC,yBAAyB,CAAC,EAC9C,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,eAAe,kBAAkB,CAAA"}
@@ -1,25 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { Buffer } from "node:buffer";
4
- import { transform as external_lightningcss_transform } from "lightningcss";
5
- async function LightningcssLoader(source, prevSourceMap) {
6
- const done = this.async();
7
- const options = this.getOptions();
8
- const { implementation, sourceMap, ...opts } = options;
9
- const transform = (null == implementation ? void 0 : implementation.transform) ?? external_lightningcss_transform;
10
- try {
11
- const { code, map } = transform({
12
- filename: this.resourcePath,
13
- code: Buffer.from(source),
14
- sourceMap,
15
- inputSourceMap: sourceMap && prevSourceMap ? JSON.stringify(prevSourceMap) : void 0,
16
- ...opts
17
- });
18
- const codeAsString = code.toString();
19
- done(null, codeAsString, map && JSON.parse(map.toString()));
20
- } catch (error) {
21
- done(error);
22
- }
23
- }
24
- const loader = LightningcssLoader;
25
- export { loader as default };
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- default: ()=>minimizer,
28
- LightningcssMinifyPlugin: ()=>LightningcssMinifyPlugin
29
- });
30
- const external_node_buffer_namespaceObject = require("node:buffer");
31
- const external_lightningcss_namespaceObject = require("lightningcss");
32
- function _define_property(obj, key, value) {
33
- if (key in obj) Object.defineProperty(obj, key, {
34
- value: value,
35
- enumerable: true,
36
- configurable: true,
37
- writable: true
38
- });
39
- else obj[key] = value;
40
- return obj;
41
- }
42
- const PLUGIN_NAME = 'LightningcssMinifyPlugin';
43
- class LightningcssMinifyPlugin {
44
- apply(compiler) {
45
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
46
- compilation.hooks.processAssets.tap({
47
- name: PLUGIN_NAME,
48
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
49
- }, ()=>this.transformAssets(compilation));
50
- compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter)=>{
51
- statsPrinter.hooks.print.for('asset.info.minimized').tap(PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
52
- });
53
- });
54
- }
55
- transformAssets(compilation) {
56
- const { options: { devtool }, webpack: { sources: { SourceMapSource, RawSource } } } = compilation.compiler;
57
- const sourceMap = 'string' == typeof devtool && devtool.includes('source-map');
58
- const assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && /\.css$/.test(asset.name));
59
- assets.map((asset)=>{
60
- const { source, map } = asset.source.sourceAndMap();
61
- const sourceAsString = source.toString();
62
- const code = 'string' == typeof source ? external_node_buffer_namespaceObject.Buffer.from(source) : source;
63
- const result = this.transform({
64
- filename: asset.name,
65
- code,
66
- minify: true,
67
- sourceMap,
68
- ...this.transformOptions
69
- });
70
- const codeString = result.code.toString();
71
- compilation.updateAsset(asset.name, sourceMap ? new SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true) : new RawSource(codeString), {
72
- ...asset.info,
73
- minimized: true
74
- });
75
- });
76
- }
77
- constructor(options = {}){
78
- _define_property(this, "transform", void 0);
79
- _define_property(this, "transformOptions", void 0);
80
- const { implementation, ...transformOptions } = options;
81
- this.transform = (null == implementation ? void 0 : implementation.transform) ?? external_lightningcss_namespaceObject.transform;
82
- this.transformOptions = transformOptions;
83
- }
84
- }
85
- const minimizer = LightningcssMinifyPlugin;
86
- exports.LightningcssMinifyPlugin = __webpack_exports__.LightningcssMinifyPlugin;
87
- exports["default"] = __webpack_exports__["default"];
88
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
89
- "LightningcssMinifyPlugin",
90
- "default"
91
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
92
- Object.defineProperty(exports, '__esModule', {
93
- value: true
94
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"minimizer.d.ts","sourceRoot":"","sources":["../../src/lightningcss/minimizer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,+BAA+B,EAEhC,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGpD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IACrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8B;gBAEnD,OAAO,GAAE,+BAAoC;IAMzD,KAAK,CAAC,QAAQ,EAAE,QAAQ;IAoBxB,OAAO,CAAC,eAAe;CAoDxB;AAED,eAAe,wBAAwB,CAAA"}
@@ -1,59 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { Buffer } from "node:buffer";
4
- import { transform } from "lightningcss";
5
- function _define_property(obj, key, value) {
6
- if (key in obj) Object.defineProperty(obj, key, {
7
- value: value,
8
- enumerable: true,
9
- configurable: true,
10
- writable: true
11
- });
12
- else obj[key] = value;
13
- return obj;
14
- }
15
- const PLUGIN_NAME = 'LightningcssMinifyPlugin';
16
- class LightningcssMinifyPlugin {
17
- apply(compiler) {
18
- compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
19
- compilation.hooks.processAssets.tap({
20
- name: PLUGIN_NAME,
21
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
22
- }, ()=>this.transformAssets(compilation));
23
- compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter)=>{
24
- statsPrinter.hooks.print.for('asset.info.minimized').tap(PLUGIN_NAME, (minimized, { green, formatFlag })=>minimized && green && formatFlag ? green(formatFlag('minimized')) : '');
25
- });
26
- });
27
- }
28
- transformAssets(compilation) {
29
- const { options: { devtool }, webpack: { sources: { SourceMapSource, RawSource } } } = compilation.compiler;
30
- const sourceMap = 'string' == typeof devtool && devtool.includes('source-map');
31
- const assets = compilation.getAssets().filter((asset)=>!asset.info.minimized && /\.css$/.test(asset.name));
32
- assets.map((asset)=>{
33
- const { source, map } = asset.source.sourceAndMap();
34
- const sourceAsString = source.toString();
35
- const code = 'string' == typeof source ? Buffer.from(source) : source;
36
- const result = this.transform({
37
- filename: asset.name,
38
- code,
39
- minify: true,
40
- sourceMap,
41
- ...this.transformOptions
42
- });
43
- const codeString = result.code.toString();
44
- compilation.updateAsset(asset.name, sourceMap ? new SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true) : new RawSource(codeString), {
45
- ...asset.info,
46
- minimized: true
47
- });
48
- });
49
- }
50
- constructor(options = {}){
51
- _define_property(this, "transform", void 0);
52
- _define_property(this, "transformOptions", void 0);
53
- const { implementation, ...transformOptions } = options;
54
- this.transform = (null == implementation ? void 0 : implementation.transform) ?? transform;
55
- this.transformOptions = transformOptions;
56
- }
57
- }
58
- const minimizer = LightningcssMinifyPlugin;
59
- export { LightningcssMinifyPlugin, minimizer as default };
package/dist/loadEnv.cjs DELETED
@@ -1,122 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- loadEnv: ()=>loadEnv
37
- });
38
- const external_node_fs_namespaceObject = require("node:fs");
39
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
40
- const external_node_path_namespaceObject = require("node:path");
41
- const external_dotenv_expand_namespaceObject = require("dotenv-expand");
42
- const external_colors_cjs_namespaceObject = require("./colors.cjs");
43
- const external_fs_cjs_namespaceObject = require("./fs.cjs");
44
- const external_logger_cjs_namespaceObject = require("./logger.cjs");
45
- const external_utils_cjs_namespaceObject = require("./utils.cjs");
46
- const DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
47
- function parse(src) {
48
- const obj = {};
49
- let lines = src.toString();
50
- lines = lines.replace(/\r\n?/gm, '\n');
51
- let match;
52
- while(null != (match = DOTENV_LINE.exec(lines))){
53
- const key = match[1];
54
- let value = match[2] || '';
55
- value = value.trim();
56
- const maybeQuote = value[0];
57
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, '$2');
58
- if ('"' === maybeQuote) {
59
- value = value.replace(/\\n/g, '\n');
60
- value = value.replace(/\\r/g, '\r');
61
- }
62
- obj[key] = value;
63
- }
64
- return obj;
65
- }
66
- function loadEnv({ cwd = process.cwd(), mode = (0, external_utils_cjs_namespaceObject.getNodeEnv)(), prefixes = [
67
- 'PUBLIC_'
68
- ], processEnv = process.env } = {}) {
69
- if ('local' === mode) throw new Error(`${external_colors_cjs_namespaceObject.colors.yellow('local')} cannot be used as a value for env mode, because ${external_colors_cjs_namespaceObject.colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
70
- const filenames = [
71
- '.env',
72
- '.env.local',
73
- `.env.${mode}`,
74
- `.env.${mode}.local`
75
- ];
76
- const filePaths = filenames.map((filename)=>(0, external_node_path_namespaceObject.join)(cwd, filename)).filter(external_fs_cjs_namespaceObject.isFileSync);
77
- const parsed = {};
78
- for (const envPath of filePaths){
79
- Object.assign(parsed, parse(external_node_fs_default().readFileSync(envPath)));
80
- external_logger_cjs_namespaceObject.logger.debug('loaded env file:', envPath);
81
- }
82
- if (parsed.NODE_ENV) processEnv.NODE_ENV = parsed.NODE_ENV;
83
- (0, external_dotenv_expand_namespaceObject.expand)({
84
- parsed,
85
- processEnv
86
- });
87
- const publicVars = {};
88
- const rawPublicVars = {};
89
- const normalizedPrefixes = Array.isArray(prefixes) ? prefixes : [
90
- prefixes
91
- ];
92
- for (const key of Object.keys(processEnv))if (normalizedPrefixes.some((prefix)=>key.startsWith(prefix))) {
93
- const val = processEnv[key];
94
- publicVars[`import.meta.env.${key}`] = JSON.stringify(val);
95
- publicVars[`process.env.${key}`] = JSON.stringify(val);
96
- rawPublicVars[key] = val;
97
- }
98
- publicVars['import.meta.env'] = JSON.stringify(rawPublicVars);
99
- publicVars['process.env'] = JSON.stringify(rawPublicVars);
100
- let cleaned = false;
101
- const cleanup = ()=>{
102
- if (cleaned) return;
103
- for (const key of Object.keys(parsed))if ('NODE_ENV' !== key) {
104
- if (processEnv[key] === parsed[key]) delete processEnv[key];
105
- }
106
- cleaned = true;
107
- };
108
- return {
109
- parsed,
110
- cleanup,
111
- filePaths,
112
- publicVars,
113
- rawPublicVars
114
- };
115
- }
116
- exports.loadEnv = __webpack_exports__.loadEnv;
117
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
118
- "loadEnv"
119
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
120
- Object.defineProperty(exports, '__esModule', {
121
- value: true
122
- });
package/dist/loadEnv.js DELETED
@@ -1,80 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import node_fs from "node:fs";
4
- import { join } from "node:path";
5
- import { expand } from "dotenv-expand";
6
- import { colors } from "./colors.js";
7
- import { isFileSync } from "./fs.js";
8
- import { logger } from "./logger.js";
9
- import { getNodeEnv } from "./utils.js";
10
- const DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
11
- function parse(src) {
12
- const obj = {};
13
- let lines = src.toString();
14
- lines = lines.replace(/\r\n?/gm, '\n');
15
- let match;
16
- while(null != (match = DOTENV_LINE.exec(lines))){
17
- const key = match[1];
18
- let value = match[2] || '';
19
- value = value.trim();
20
- const maybeQuote = value[0];
21
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, '$2');
22
- if ('"' === maybeQuote) {
23
- value = value.replace(/\\n/g, '\n');
24
- value = value.replace(/\\r/g, '\r');
25
- }
26
- obj[key] = value;
27
- }
28
- return obj;
29
- }
30
- function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
31
- 'PUBLIC_'
32
- ], processEnv = process.env } = {}) {
33
- if ('local' === mode) throw new Error(`${colors.yellow('local')} cannot be used as a value for env mode, because ${colors.yellow('.env.local')} represents a temporary local file. Please use another value.`);
34
- const filenames = [
35
- '.env',
36
- '.env.local',
37
- `.env.${mode}`,
38
- `.env.${mode}.local`
39
- ];
40
- const filePaths = filenames.map((filename)=>join(cwd, filename)).filter(isFileSync);
41
- const parsed = {};
42
- for (const envPath of filePaths){
43
- Object.assign(parsed, parse(node_fs.readFileSync(envPath)));
44
- logger.debug('loaded env file:', envPath);
45
- }
46
- if (parsed.NODE_ENV) processEnv.NODE_ENV = parsed.NODE_ENV;
47
- expand({
48
- parsed,
49
- processEnv
50
- });
51
- const publicVars = {};
52
- const rawPublicVars = {};
53
- const normalizedPrefixes = Array.isArray(prefixes) ? prefixes : [
54
- prefixes
55
- ];
56
- for (const key of Object.keys(processEnv))if (normalizedPrefixes.some((prefix)=>key.startsWith(prefix))) {
57
- const val = processEnv[key];
58
- publicVars[`import.meta.env.${key}`] = JSON.stringify(val);
59
- publicVars[`process.env.${key}`] = JSON.stringify(val);
60
- rawPublicVars[key] = val;
61
- }
62
- publicVars['import.meta.env'] = JSON.stringify(rawPublicVars);
63
- publicVars['process.env'] = JSON.stringify(rawPublicVars);
64
- let cleaned = false;
65
- const cleanup = ()=>{
66
- if (cleaned) return;
67
- for (const key of Object.keys(parsed))if ('NODE_ENV' !== key) {
68
- if (processEnv[key] === parsed[key]) delete processEnv[key];
69
- }
70
- cleaned = true;
71
- };
72
- return {
73
- parsed,
74
- cleanup,
75
- filePaths,
76
- publicVars,
77
- rawPublicVars
78
- };
79
- }
80
- export { loadEnv };