@unpackjs/core 1.5.4 → 1.6.0

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 (238) hide show
  1. package/bin/openChrome.applescript +94 -0
  2. package/compiled/chokidar/index.d.ts +327 -0
  3. package/compiled/chokidar/index.js +1773 -0
  4. package/compiled/chokidar/license +21 -0
  5. package/compiled/chokidar/package.json +1 -0
  6. package/compiled/commander/index.d.ts +971 -0
  7. package/compiled/commander/index.js +2190 -0
  8. package/compiled/commander/license +22 -0
  9. package/compiled/commander/package.json +1 -0
  10. package/compiled/css-loader/api.js +85 -0
  11. package/compiled/css-loader/getUrl.js +26 -0
  12. package/compiled/css-loader/index.d.ts +1 -0
  13. package/compiled/css-loader/index.js +8004 -0
  14. package/compiled/css-loader/license +20 -0
  15. package/compiled/css-loader/noSourceMaps.js +5 -0
  16. package/compiled/css-loader/package.json +1 -0
  17. package/compiled/css-loader/sourceMaps.js +16 -0
  18. package/compiled/fast-glob/index.d.ts +237 -0
  19. package/compiled/fast-glob/index.js +5726 -0
  20. package/compiled/fast-glob/license +21 -0
  21. package/compiled/fast-glob/package.json +1 -0
  22. package/compiled/less-loader/index.d.ts +1 -0
  23. package/compiled/less-loader/index.js +340 -0
  24. package/compiled/less-loader/license +20 -0
  25. package/compiled/less-loader/package.json +1 -0
  26. package/compiled/line-diff/index.d.ts +1 -0
  27. package/compiled/line-diff/index.js +160 -0
  28. package/compiled/line-diff/license +21 -0
  29. package/compiled/line-diff/package.json +1 -0
  30. package/compiled/log-update/index.d.ts +1 -0
  31. package/compiled/log-update/index.js +1970 -0
  32. package/compiled/log-update/package.json +1 -0
  33. package/compiled/portfinder/index.d.ts +64 -0
  34. package/compiled/portfinder/index.js +3401 -0
  35. package/compiled/portfinder/license +22 -0
  36. package/compiled/portfinder/package.json +1 -0
  37. package/compiled/postcss-loader/index.d.ts +1 -0
  38. package/compiled/postcss-loader/index.js +94945 -0
  39. package/compiled/postcss-loader/license +20 -0
  40. package/compiled/postcss-loader/package.json +1 -0
  41. package/compiled/sass-loader/index.d.ts +961 -0
  42. package/compiled/sass-loader/index.js +5610 -0
  43. package/compiled/sass-loader/index1.js +65 -0
  44. package/compiled/sass-loader/license +20 -0
  45. package/compiled/sass-loader/package.json +1 -0
  46. package/compiled/sass-loader/sass.node.js +12 -0
  47. package/compiled/semver/index.d.ts +1 -0
  48. package/compiled/semver/index.js +1940 -0
  49. package/compiled/semver/license +15 -0
  50. package/compiled/semver/package.json +1 -0
  51. package/compiled/style-loader/index.d.ts +1 -0
  52. package/compiled/style-loader/index.js +370 -0
  53. package/compiled/style-loader/license +20 -0
  54. package/compiled/style-loader/package.json +1 -0
  55. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  56. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  57. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  58. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  59. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  60. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  61. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  62. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  63. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  64. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  65. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  66. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  67. package/compiled/webpack-bundle-analyzer/index.d.ts +1 -0
  68. package/compiled/webpack-bundle-analyzer/index.js +13276 -0
  69. package/compiled/webpack-bundle-analyzer/license +20 -0
  70. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  71. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  72. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  73. package/compiled/webpack-merge/index.d.ts +31 -0
  74. package/compiled/webpack-merge/index.js +1200 -0
  75. package/compiled/webpack-merge/license +20 -0
  76. package/compiled/webpack-merge/package.json +1 -0
  77. package/dist/bundleRequire.cjs +200 -0
  78. package/dist/bundleRequire.d.ts +5 -0
  79. package/dist/bundleRequire.d.ts.map +1 -0
  80. package/dist/bundleRequire.js +173 -0
  81. package/dist/bundler-config/chunkSplit.cjs +151 -0
  82. package/dist/bundler-config/chunkSplit.d.ts +6 -0
  83. package/dist/bundler-config/chunkSplit.d.ts.map +1 -0
  84. package/dist/bundler-config/chunkSplit.js +127 -0
  85. package/dist/bundler-config/css.cjs +168 -0
  86. package/dist/bundler-config/css.d.ts +6 -0
  87. package/dist/bundler-config/css.d.ts.map +1 -0
  88. package/dist/bundler-config/css.js +158 -0
  89. package/dist/bundler-config/experimentCss.cjs +167 -0
  90. package/dist/bundler-config/experimentCss.d.ts +6 -0
  91. package/dist/bundler-config/experimentCss.d.ts.map +1 -0
  92. package/dist/bundler-config/experimentCss.js +157 -0
  93. package/dist/bundler-config/helper.cjs +81 -0
  94. package/dist/bundler-config/helper.d.ts +8 -0
  95. package/dist/bundler-config/helper.d.ts.map +1 -0
  96. package/dist/bundler-config/helper.js +56 -0
  97. package/dist/bundler-config/index.cjs +206 -0
  98. package/dist/bundler-config/index.d.ts +3 -0
  99. package/dist/bundler-config/index.d.ts.map +1 -0
  100. package/dist/bundler-config/index.js +190 -0
  101. package/dist/colors.cjs +60 -0
  102. package/dist/colors.d.ts +6 -0
  103. package/dist/colors.d.ts.map +1 -0
  104. package/dist/colors.js +40 -0
  105. package/dist/{config/index.cjs → config.cjs} +26 -20
  106. package/dist/{config/index.d.ts → config.d.ts} +4 -3
  107. package/dist/config.d.ts.map +1 -0
  108. package/dist/{config/index.js → config.js} +19 -21
  109. package/dist/constants.cjs +86 -0
  110. package/dist/constants.d.ts +25 -0
  111. package/dist/constants.d.ts.map +1 -0
  112. package/dist/constants.js +61 -0
  113. package/dist/createService.cjs +65 -0
  114. package/dist/createService.d.ts +8 -0
  115. package/dist/createService.d.ts.map +1 -0
  116. package/dist/createService.js +41 -0
  117. package/dist/index.cjs +27 -48
  118. package/dist/index.d.ts +7 -7
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +8 -51
  121. package/dist/lightningcss/cache.cjs +36 -0
  122. package/dist/lightningcss/cache.d.ts +2 -0
  123. package/dist/lightningcss/cache.d.ts.map +1 -0
  124. package/dist/lightningcss/cache.js +22 -0
  125. package/dist/lightningcss/index.cjs +21 -0
  126. package/dist/lightningcss/index.d.ts +2 -0
  127. package/dist/lightningcss/index.d.ts.map +1 -0
  128. package/dist/lightningcss/index.js +10 -0
  129. package/dist/lightningcss/loader.cjs +56 -0
  130. package/dist/lightningcss/loader.d.ts +5 -0
  131. package/dist/lightningcss/loader.d.ts.map +1 -0
  132. package/dist/lightningcss/loader.js +36 -0
  133. package/dist/lightningcss/minimizer.cjs +114 -0
  134. package/dist/lightningcss/minimizer.d.ts +11 -0
  135. package/dist/lightningcss/minimizer.d.ts.map +1 -0
  136. package/dist/lightningcss/minimizer.js +90 -0
  137. package/dist/logger.cjs +103 -0
  138. package/dist/logger.d.ts +3 -0
  139. package/dist/logger.d.ts.map +1 -0
  140. package/dist/logger.js +79 -0
  141. package/dist/openBrowser.cjs +85 -0
  142. package/dist/openBrowser.d.ts +2 -0
  143. package/dist/openBrowser.d.ts.map +1 -0
  144. package/dist/openBrowser.js +61 -0
  145. package/dist/plugin-progress/rspack.cjs +74 -0
  146. package/dist/plugin-progress/rspack.d.ts +9 -0
  147. package/dist/plugin-progress/rspack.d.ts.map +1 -0
  148. package/dist/plugin-progress/rspack.js +50 -0
  149. package/dist/plugin-progress/webpack.cjs +84 -0
  150. package/dist/plugin-progress/webpack.d.ts +9 -0
  151. package/dist/plugin-progress/webpack.d.ts.map +1 -0
  152. package/dist/plugin-progress/webpack.js +60 -0
  153. package/dist/plugin.cjs +33 -0
  154. package/dist/plugin.d.ts +3 -0
  155. package/dist/plugin.d.ts.map +1 -0
  156. package/dist/plugin.js +19 -0
  157. package/dist/progressBar.cjs +70 -0
  158. package/dist/progressBar.d.ts +14 -0
  159. package/dist/progressBar.d.ts.map +1 -0
  160. package/dist/progressBar.js +46 -0
  161. package/dist/reporter.cjs +133 -0
  162. package/dist/reporter.d.ts +8 -0
  163. package/dist/reporter.d.ts.map +1 -0
  164. package/dist/reporter.js +109 -0
  165. package/dist/run/build.cjs +77 -0
  166. package/dist/run/build.d.ts +3 -0
  167. package/dist/run/build.d.ts.map +1 -0
  168. package/dist/run/build.js +53 -0
  169. package/dist/run/dev.cjs +107 -0
  170. package/dist/run/dev.d.ts +3 -0
  171. package/dist/run/dev.d.ts.map +1 -0
  172. package/dist/run/dev.js +83 -0
  173. package/dist/run/index.cjs +23 -0
  174. package/dist/run/index.d.ts +3 -0
  175. package/dist/run/index.d.ts.map +1 -0
  176. package/dist/run/index.js +11 -0
  177. package/dist/thread-loader/WorkerError.cjs +41 -0
  178. package/dist/thread-loader/WorkerError.js +31 -0
  179. package/dist/thread-loader/WorkerPool.cjs +407 -0
  180. package/dist/thread-loader/WorkerPool.js +387 -0
  181. package/dist/thread-loader/index.cjs +100 -0
  182. package/dist/thread-loader/index.js +85 -0
  183. package/dist/thread-loader/readBuffer.cjs +55 -0
  184. package/dist/thread-loader/readBuffer.js +45 -0
  185. package/dist/thread-loader/serializer.cjs +46 -0
  186. package/dist/thread-loader/serializer.js +31 -0
  187. package/dist/thread-loader/utils.cjs +84 -0
  188. package/dist/thread-loader/utils.js +60 -0
  189. package/dist/thread-loader/worker.cjs +377 -0
  190. package/dist/thread-loader/worker.js +382 -0
  191. package/dist/thread-loader/workerPools.cjs +57 -0
  192. package/dist/thread-loader/workerPools.js +33 -0
  193. package/dist/typed-css-modules/index.cjs +21 -0
  194. package/dist/typed-css-modules/index.d.ts +2 -0
  195. package/dist/typed-css-modules/index.d.ts.map +1 -0
  196. package/dist/typed-css-modules/index.js +10 -0
  197. package/dist/typed-css-modules/loader.cjs +195 -0
  198. package/dist/typed-css-modules/loader.d.ts +10 -0
  199. package/dist/typed-css-modules/loader.d.ts.map +1 -0
  200. package/dist/typed-css-modules/loader.js +170 -0
  201. package/dist/typed-css-modules/plugin.cjs +96 -0
  202. package/dist/typed-css-modules/plugin.d.ts +16 -0
  203. package/dist/typed-css-modules/plugin.d.ts.map +1 -0
  204. package/dist/typed-css-modules/plugin.js +72 -0
  205. package/dist/typed-css-modules/utils.cjs +45 -0
  206. package/dist/typed-css-modules/utils.d.ts +6 -0
  207. package/dist/typed-css-modules/utils.d.ts.map +1 -0
  208. package/dist/typed-css-modules/utils.js +31 -0
  209. package/dist/types/chunkSplit.cjs +15 -0
  210. package/dist/types/chunkSplit.d.ts +35 -0
  211. package/dist/types/chunkSplit.d.ts.map +1 -0
  212. package/dist/types/chunkSplit.js +9 -0
  213. package/dist/types/config.cjs +15 -0
  214. package/dist/types/config.d.ts +176 -0
  215. package/dist/types/config.d.ts.map +1 -0
  216. package/dist/types/config.js +9 -0
  217. package/dist/types/index.cjs +29 -0
  218. package/dist/types/index.d.ts +16 -0
  219. package/dist/types/index.d.ts.map +1 -0
  220. package/dist/types/index.js +14 -0
  221. package/dist/types/lightningcss.cjs +15 -0
  222. package/dist/types/lightningcss.d.ts +11 -0
  223. package/dist/types/lightningcss.d.ts.map +1 -0
  224. package/dist/types/lightningcss.js +9 -0
  225. package/dist/types/logger.cjs +35 -0
  226. package/dist/types/logger.d.ts +16 -0
  227. package/dist/types/logger.d.ts.map +1 -0
  228. package/dist/types/logger.js +21 -0
  229. package/dist/types/plugin.cjs +15 -0
  230. package/dist/types/plugin.d.ts +18 -0
  231. package/dist/types/plugin.d.ts.map +1 -0
  232. package/dist/types/plugin.js +9 -0
  233. package/dist/utils.cjs +293 -0
  234. package/dist/utils.d.ts +39 -0
  235. package/dist/utils.d.ts.map +1 -0
  236. package/dist/utils.js +242 -0
  237. package/package.json +95 -6
  238. package/dist/config/index.d.ts.map +0 -1
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var cache_exports = {};
19
+ __export(cache_exports, {
20
+ getLightningcssTargets: () => getLightningcssTargets
21
+ });
22
+ module.exports = __toCommonJS(cache_exports);
23
+ var import_lightningcss = require("lightningcss");
24
+ var import_constants = require("../constants.cjs");
25
+ let lightningcssTargetsCache = null;
26
+ const getLightningcssTargets = () => {
27
+ if (lightningcssTargetsCache)
28
+ return lightningcssTargetsCache;
29
+ const targets = (0, import_lightningcss.browserslistToTargets)(import_constants.DEFAULT_BROWSERSLIST);
30
+ lightningcssTargetsCache = targets;
31
+ return targets;
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ getLightningcssTargets
36
+ });
@@ -0,0 +1,2 @@
1
+ export declare const getLightningcssTargets: () => any;
2
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/lightningcss/cache.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,WAKlC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { createRequire } from 'node:module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import { browserslistToTargets } from "lightningcss";
11
+ import { DEFAULT_BROWSERSLIST } from "../constants.js";
12
+ let lightningcssTargetsCache = null;
13
+ const getLightningcssTargets = () => {
14
+ if (lightningcssTargetsCache)
15
+ return lightningcssTargetsCache;
16
+ const targets = browserslistToTargets(DEFAULT_BROWSERSLIST);
17
+ lightningcssTargetsCache = targets;
18
+ return targets;
19
+ };
20
+ export {
21
+ getLightningcssTargets
22
+ };
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var lightningcss_exports = {};
16
+ module.exports = __toCommonJS(lightningcss_exports);
17
+ __reExport(lightningcss_exports, require("./minimizer.cjs"), module.exports);
18
+ // Annotate the CommonJS export names for ESM import in node:
19
+ 0 && (module.exports = {
20
+ ...require("./minimizer.cjs")
21
+ });
@@ -0,0 +1,2 @@
1
+ export * from './minimizer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lightningcss/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'node:module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ export * from "./minimizer.js";
@@ -0,0 +1,56 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var loader_exports = {};
29
+ __export(loader_exports, {
30
+ default: () => loader_default
31
+ });
32
+ module.exports = __toCommonJS(loader_exports);
33
+ var import_node_buffer = require("node:buffer");
34
+ var lightningcss = __toESM(require("lightningcss"));
35
+ var import_cache = require("./cache.cjs");
36
+ async function LightningcssLoader(source, prevSourceMap) {
37
+ const done = this.async();
38
+ const options = this.getOptions();
39
+ const { implementation, sourceMap, ...opts } = options;
40
+ const transform = implementation?.transform ?? lightningcss.transform;
41
+ try {
42
+ const { code, map } = transform({
43
+ filename: this.resourcePath,
44
+ code: import_node_buffer.Buffer.from(source),
45
+ sourceMap,
46
+ targets: (0, import_cache.getLightningcssTargets)(),
47
+ inputSourceMap: sourceMap && prevSourceMap ? JSON.stringify(prevSourceMap) : void 0,
48
+ ...opts
49
+ });
50
+ const codeAsString = code.toString();
51
+ done(null, codeAsString, map && JSON.parse(map.toString()));
52
+ } catch (error) {
53
+ done(error);
54
+ }
55
+ }
56
+ var loader_default = LightningcssLoader;
@@ -0,0 +1,5 @@
1
+ import type { LightningcssLoaderOptions } from '../types/index';
2
+ import type { LoaderContext } from 'webpack';
3
+ declare function LightningcssLoader(this: LoaderContext<LightningcssLoaderOptions>, source: string, prevSourceMap?: Record<string, unknown>): Promise<void>;
4
+ export default LightningcssLoader;
5
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
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,CAoBf;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { createRequire } from 'node:module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import { Buffer } from "node:buffer";
11
+ import * as lightningcss from "lightningcss";
12
+ import { getLightningcssTargets } from "./cache.js";
13
+ async function LightningcssLoader(source, prevSourceMap) {
14
+ const done = this.async();
15
+ const options = this.getOptions();
16
+ const { implementation, sourceMap, ...opts } = options;
17
+ const transform = implementation?.transform ?? lightningcss.transform;
18
+ try {
19
+ const { code, map } = transform({
20
+ filename: this.resourcePath,
21
+ code: Buffer.from(source),
22
+ sourceMap,
23
+ targets: getLightningcssTargets(),
24
+ inputSourceMap: sourceMap && prevSourceMap ? JSON.stringify(prevSourceMap) : void 0,
25
+ ...opts
26
+ });
27
+ const codeAsString = code.toString();
28
+ done(null, codeAsString, map && JSON.parse(map.toString()));
29
+ } catch (error) {
30
+ done(error);
31
+ }
32
+ }
33
+ var loader_default = LightningcssLoader;
34
+ export {
35
+ loader_default as default
36
+ };
@@ -0,0 +1,114 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var minimizer_exports = {};
29
+ __export(minimizer_exports, {
30
+ LightningcssMinifyPlugin: () => LightningcssMinifyPlugin,
31
+ default: () => minimizer_default
32
+ });
33
+ module.exports = __toCommonJS(minimizer_exports);
34
+ var import_node_buffer = require("node:buffer");
35
+ var lightningcss = __toESM(require("lightningcss"));
36
+ var import_cache = require("./cache.cjs");
37
+ const PLUGIN_NAME = "PluginLightningcssMinify";
38
+ class LightningcssMinifyPlugin {
39
+ constructor(opts = {}) {
40
+ this.transform = opts.implementation?.transform ?? lightningcss.transform;
41
+ this.options = opts;
42
+ }
43
+ apply(compiler) {
44
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
45
+ compilation.hooks.processAssets.tapPromise(
46
+ {
47
+ name: PLUGIN_NAME,
48
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
49
+ },
50
+ async () => this.transformAssets(compilation)
51
+ );
52
+ compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter) => {
53
+ statsPrinter.hooks.print.for("asset.info.minimized").tap(
54
+ PLUGIN_NAME,
55
+ (minimized, { green, formatFlag }) => minimized && green && formatFlag ? green(formatFlag("minimized")) : ""
56
+ );
57
+ });
58
+ });
59
+ }
60
+ async transformAssets(compilation) {
61
+ const {
62
+ options: { devtool },
63
+ webpack: {
64
+ sources: { SourceMapSource, RawSource }
65
+ }
66
+ } = compilation.compiler;
67
+ const sourceMap = this.options.sourceMap === void 0 ? devtool && devtool.includes("source-map") : this.options.sourceMap;
68
+ const { implementation, ...transformOptions } = this.options;
69
+ const assets = compilation.getAssets().filter(
70
+ (asset) => (
71
+ // Filter out already minimized
72
+ !asset.info.minimized && // Filter out by file type
73
+ /\.css$/.test(asset.name)
74
+ )
75
+ );
76
+ await Promise.all(
77
+ assets.map(async (asset) => {
78
+ const { source, map } = asset.source.sourceAndMap();
79
+ const sourceAsString = source.toString();
80
+ const code = typeof source === "string" ? import_node_buffer.Buffer.from(source) : source;
81
+ const result = this.transform({
82
+ filename: asset.name,
83
+ code,
84
+ minify: true,
85
+ sourceMap,
86
+ targets: (0, import_cache.getLightningcssTargets)(),
87
+ ...transformOptions
88
+ });
89
+ const codeString = result.code.toString();
90
+ compilation.updateAsset(
91
+ asset.name,
92
+ sourceMap ? new SourceMapSource(
93
+ codeString,
94
+ asset.name,
95
+ // @ts-ignore
96
+ JSON.parse(result.map.toString()),
97
+ sourceAsString,
98
+ map,
99
+ true
100
+ ) : new RawSource(codeString),
101
+ {
102
+ ...asset.info,
103
+ minimized: true
104
+ }
105
+ );
106
+ })
107
+ );
108
+ }
109
+ }
110
+ var minimizer_default = LightningcssMinifyPlugin;
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ LightningcssMinifyPlugin
114
+ });
@@ -0,0 +1,11 @@
1
+ import type { LightningcssMinifyPluginOptions } from '../types/index';
2
+ import type { Compiler } from 'webpack';
3
+ export declare class LightningcssMinifyPlugin {
4
+ private readonly options;
5
+ private readonly transform;
6
+ constructor(opts?: LightningcssMinifyPluginOptions);
7
+ apply(compiler: Compiler): void;
8
+ private transformAssets;
9
+ }
10
+ export default LightningcssMinifyPlugin;
11
+ //# sourceMappingURL=minimizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimizer.d.ts","sourceRoot":"","sources":["../../src/lightningcss/minimizer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,+BAA+B,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIpD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;gBAEzC,IAAI,GAAE,+BAAoC;IAKtD,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAoBV,eAAe;CA4D9B;AAED,eAAe,wBAAwB,CAAA"}
@@ -0,0 +1,90 @@
1
+ import { createRequire } from 'node:module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import { Buffer } from "node:buffer";
11
+ import * as lightningcss from "lightningcss";
12
+ import { getLightningcssTargets } from "./cache.js";
13
+ const PLUGIN_NAME = "PluginLightningcssMinify";
14
+ class LightningcssMinifyPlugin {
15
+ constructor(opts = {}) {
16
+ this.transform = opts.implementation?.transform ?? lightningcss.transform;
17
+ this.options = opts;
18
+ }
19
+ apply(compiler) {
20
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
21
+ compilation.hooks.processAssets.tapPromise(
22
+ {
23
+ name: PLUGIN_NAME,
24
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
25
+ },
26
+ async () => this.transformAssets(compilation)
27
+ );
28
+ compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter) => {
29
+ statsPrinter.hooks.print.for("asset.info.minimized").tap(
30
+ PLUGIN_NAME,
31
+ (minimized, { green, formatFlag }) => minimized && green && formatFlag ? green(formatFlag("minimized")) : ""
32
+ );
33
+ });
34
+ });
35
+ }
36
+ async transformAssets(compilation) {
37
+ const {
38
+ options: { devtool },
39
+ webpack: {
40
+ sources: { SourceMapSource, RawSource }
41
+ }
42
+ } = compilation.compiler;
43
+ const sourceMap = this.options.sourceMap === void 0 ? devtool && devtool.includes("source-map") : this.options.sourceMap;
44
+ const { implementation, ...transformOptions } = this.options;
45
+ const assets = compilation.getAssets().filter(
46
+ (asset) => (
47
+ // Filter out already minimized
48
+ !asset.info.minimized && // Filter out by file type
49
+ /\.css$/.test(asset.name)
50
+ )
51
+ );
52
+ await Promise.all(
53
+ assets.map(async (asset) => {
54
+ const { source, map } = asset.source.sourceAndMap();
55
+ const sourceAsString = source.toString();
56
+ const code = typeof source === "string" ? Buffer.from(source) : source;
57
+ const result = this.transform({
58
+ filename: asset.name,
59
+ code,
60
+ minify: true,
61
+ sourceMap,
62
+ targets: getLightningcssTargets(),
63
+ ...transformOptions
64
+ });
65
+ const codeString = result.code.toString();
66
+ compilation.updateAsset(
67
+ asset.name,
68
+ sourceMap ? new SourceMapSource(
69
+ codeString,
70
+ asset.name,
71
+ // @ts-ignore
72
+ JSON.parse(result.map.toString()),
73
+ sourceAsString,
74
+ map,
75
+ true
76
+ ) : new RawSource(codeString),
77
+ {
78
+ ...asset.info,
79
+ minimized: true
80
+ }
81
+ );
82
+ })
83
+ );
84
+ }
85
+ }
86
+ var minimizer_default = LightningcssMinifyPlugin;
87
+ export {
88
+ LightningcssMinifyPlugin,
89
+ minimizer_default as default
90
+ };
@@ -0,0 +1,103 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var logger_exports = {};
29
+ __export(logger_exports, {
30
+ logger: () => logger
31
+ });
32
+ module.exports = __toCommonJS(logger_exports);
33
+ var import_node_readline = __toESM(require("node:readline"));
34
+ var import_colors = __toESM(require("./colors.cjs"));
35
+ var import_types = require("./types/index.cjs");
36
+ const prefixes = {
37
+ wait: "○",
38
+ error: "⨯",
39
+ warn: "⚠",
40
+ info: "ℹ",
41
+ ready: "✓",
42
+ event: "»"
43
+ };
44
+ const createLogger = () => {
45
+ const log = (type, message, ...args) => {
46
+ const label = import_colors.default[import_types.LogColor[type]](import_colors.default.bold(prefixes[type]));
47
+ let text = "";
48
+ switch (type) {
49
+ case "error":
50
+ if (message instanceof Error) {
51
+ if (message.stack) {
52
+ let [name, ...rest] = message.stack.split("\n");
53
+ if (name.startsWith("Error: ")) {
54
+ name = name.slice(7);
55
+ rest = rest.map((line) => line.slice(2));
56
+ }
57
+ text = `${import_colors.default.red(name)}
58
+ ${import_colors.default.dim(rest.join("\n"))}`;
59
+ } else {
60
+ text = import_colors.default.red(message.message);
61
+ }
62
+ } else {
63
+ text = import_colors.default.red(message);
64
+ }
65
+ break;
66
+ case "warn":
67
+ text = import_colors.default.yellow(message);
68
+ break;
69
+ default:
70
+ text = message;
71
+ break;
72
+ }
73
+ console.log(`${label} ${text}`, ...args);
74
+ };
75
+ const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
76
+ const logger2 = {
77
+ clear: () => {
78
+ const repeatCount = process.stdout.rows - 2;
79
+ const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
80
+ console.log(blank);
81
+ import_node_readline.default.cursorTo(process.stdout, 0, 0);
82
+ import_node_readline.default.clearScreenDown(process.stdout);
83
+ },
84
+ greet: (msg) => {
85
+ const { npm_execpath, npm_lifecycle_event } = process.env;
86
+ if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
87
+ console.log();
88
+ }
89
+ console.log(msg);
90
+ }
91
+ };
92
+ logTypes.forEach((type) => {
93
+ logger2[type] = (message, ...args) => {
94
+ log(type, message, ...args);
95
+ };
96
+ });
97
+ return logger2;
98
+ };
99
+ const logger = createLogger();
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ logger
103
+ });
@@ -0,0 +1,3 @@
1
+ import { type Logger } from './types/index';
2
+ export declare const logger: Logger;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA0ErE,eAAO,MAAM,MAAM,QAAiB,CAAA"}
package/dist/logger.js ADDED
@@ -0,0 +1,79 @@
1
+ import { createRequire } from 'node:module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import readline from "node:readline";
11
+ import colors from "./colors.js";
12
+ import { LogColor } from "./types/index.js";
13
+ const prefixes = {
14
+ wait: "○",
15
+ error: "⨯",
16
+ warn: "⚠",
17
+ info: "ℹ",
18
+ ready: "✓",
19
+ event: "»"
20
+ };
21
+ const createLogger = () => {
22
+ const log = (type, message, ...args) => {
23
+ const label = colors[LogColor[type]](colors.bold(prefixes[type]));
24
+ let text = "";
25
+ switch (type) {
26
+ case "error":
27
+ if (message instanceof Error) {
28
+ if (message.stack) {
29
+ let [name, ...rest] = message.stack.split("\n");
30
+ if (name.startsWith("Error: ")) {
31
+ name = name.slice(7);
32
+ rest = rest.map((line) => line.slice(2));
33
+ }
34
+ text = `${colors.red(name)}
35
+ ${colors.dim(rest.join("\n"))}`;
36
+ } else {
37
+ text = colors.red(message.message);
38
+ }
39
+ } else {
40
+ text = colors.red(message);
41
+ }
42
+ break;
43
+ case "warn":
44
+ text = colors.yellow(message);
45
+ break;
46
+ default:
47
+ text = message;
48
+ break;
49
+ }
50
+ console.log(`${label} ${text}`, ...args);
51
+ };
52
+ const logTypes = ["error", "warn", "info", "ready", "event", "wait"];
53
+ const logger2 = {
54
+ clear: () => {
55
+ const repeatCount = process.stdout.rows - 2;
56
+ const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
57
+ console.log(blank);
58
+ readline.cursorTo(process.stdout, 0, 0);
59
+ readline.clearScreenDown(process.stdout);
60
+ },
61
+ greet: (msg) => {
62
+ const { npm_execpath, npm_lifecycle_event } = process.env;
63
+ if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
64
+ console.log();
65
+ }
66
+ console.log(msg);
67
+ }
68
+ };
69
+ logTypes.forEach((type) => {
70
+ logger2[type] = (message, ...args) => {
71
+ log(type, message, ...args);
72
+ };
73
+ });
74
+ return logger2;
75
+ };
76
+ const logger = createLogger();
77
+ export {
78
+ logger
79
+ };