@unpackjs/core 2.3.0 → 2.3.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 (44) hide show
  1. package/compiled/css-loader/index.js +20 -20
  2. package/compiled/less-loader/index.js +8 -8
  3. package/compiled/postcss-loader/index.js +8 -8
  4. package/compiled/sass-loader/index.js +8 -8
  5. package/compiled/webpack-bundle-analyzer/index.js +21 -13274
  6. package/dist/bundler-config/index.cjs +9 -12
  7. package/dist/bundler-config/index.d.ts.map +1 -1
  8. package/dist/bundler-config/index.js +7 -13
  9. package/dist/bundler-config/jsMinify.cjs +1 -1
  10. package/dist/bundler-config/jsMinify.js +1 -1
  11. package/dist/bundler-config/progress/helpers.cjs +1 -1
  12. package/dist/bundler-config/progress/helpers.d.ts.map +1 -1
  13. package/dist/bundler-config/progress/helpers.js +1 -1
  14. package/dist/colors.cjs +4 -4
  15. package/dist/colors.js +4 -4
  16. package/dist/createUnpack.cjs +2 -2
  17. package/dist/createUnpack.js +2 -2
  18. package/dist/index.js +36 -5
  19. package/dist/logger.cjs +11 -1
  20. package/dist/logger.d.ts.map +1 -1
  21. package/dist/logger.js +11 -1
  22. package/dist/openBrowser.cjs +46 -61
  23. package/dist/openBrowser.d.ts.map +1 -1
  24. package/dist/openBrowser.js +2 -18
  25. package/dist/prebundleDeps.cjs +2 -2
  26. package/dist/prebundleDeps.js +2 -2
  27. package/dist/run/dev.cjs +1 -1
  28. package/dist/run/dev.js +1 -1
  29. package/dist/typed-css-modules/loader.cjs +115 -130
  30. package/dist/typed-css-modules/loader.d.ts.map +1 -1
  31. package/dist/typed-css-modules/loader.js +2 -18
  32. package/dist/types/config.d.ts +1 -1
  33. package/dist/utils.cjs +3 -5
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +1 -5
  36. package/package.json +4 -12
  37. package/compiled/line-diff/index.d.ts +0 -1
  38. package/compiled/line-diff/index.js +0 -160
  39. package/compiled/line-diff/license +0 -21
  40. package/compiled/line-diff/package.json +0 -1
  41. package/compiled/portfinder/index.d.ts +0 -105
  42. package/compiled/portfinder/index.js +0 -3231
  43. package/compiled/portfinder/license +0 -22
  44. package/compiled/portfinder/package.json +0 -1
@@ -1,19 +1,5 @@
1
1
  "use strict";
2
- var __webpack_modules__ = {
3
- "../../compiled/line-diff/index.js": function(module) {
4
- module.exports = require("../../compiled/line-diff/index.js");
5
- }
6
- };
7
- var __webpack_module_cache__ = {};
8
- function __webpack_require__(moduleId) {
9
- var cachedModule = __webpack_module_cache__[moduleId];
10
- if (void 0 !== cachedModule) return cachedModule.exports;
11
- var module = __webpack_module_cache__[moduleId] = {
12
- exports: {}
13
- };
14
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
- return module.exports;
16
- }
2
+ var __webpack_require__ = {};
17
3
  (()=>{
18
4
  __webpack_require__.n = (module)=>{
19
5
  var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
@@ -45,128 +31,127 @@ function __webpack_require__(moduleId) {
45
31
  };
46
32
  })();
47
33
  var __webpack_exports__ = {};
48
- (()=>{
49
- __webpack_require__.r(__webpack_exports__);
50
- __webpack_require__.d(__webpack_exports__, {
51
- wrapQuotes: ()=>wrapQuotes,
52
- default: ()=>loader,
53
- isInNodeModules: ()=>isInNodeModules
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ wrapQuotes: ()=>wrapQuotes,
37
+ default: ()=>loader,
38
+ isInNodeModules: ()=>isInNodeModules
39
+ });
40
+ const external_node_fs_namespaceObject = require("node:fs");
41
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
42
+ const external_node_path_namespaceObject = require("node:path");
43
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
44
+ const external_line_diff_namespaceObject = require("line-diff");
45
+ var external_line_diff_default = /*#__PURE__*/ __webpack_require__.n(external_line_diff_namespaceObject);
46
+ const external_constants_cjs_namespaceObject = require("../constants.cjs");
47
+ const external_utils_cjs_namespaceObject = require("./utils.cjs");
48
+ const isInNodeModules = (path)=>external_constants_cjs_namespaceObject.NODE_MODULES_REGEX.test(path);
49
+ const getNoDeclarationFileError = ({ filename })=>new Error(`Generated type declaration does not exist. Run dev and commit the type declaration for '${filename}'`);
50
+ const getTypeMismatchError = ({ filename, expected, actual })=>{
51
+ const diff = new (external_line_diff_default())(enforceLFLineSeparators(actual), expected).toString();
52
+ return new Error(`Generated type declaration file is outdated. Run dev and commit the updated type declaration for '${filename}'\n\n${diff}`);
53
+ };
54
+ function wrapQuotes(key) {
55
+ const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
56
+ if (isValidIdentifier) return key;
57
+ return `'${key}'`;
58
+ }
59
+ const cssModuleToNamedExports = (cssModuleKeys)=>cssModuleKeys.sort().map((key)=>`export const ${key}: string;`).join('\n');
60
+ const cssModuleToInterface = (cssModulesKeys)=>{
61
+ const interfaceFields = cssModulesKeys.sort().map((key)=>` ${wrapQuotes(key)}: string;`).join('\n');
62
+ return `interface CssExports {\n${interfaceFields}\n}`;
63
+ };
64
+ const filenameToTypingsFilename = (filename)=>{
65
+ const dirName = external_node_path_default().dirname(filename);
66
+ const baseName = external_node_path_default().basename(filename);
67
+ return external_node_path_default().join(dirName, `${baseName}.d.ts`);
68
+ };
69
+ const enforceLFLineSeparators = (text)=>{
70
+ if (text) return text.replace(/\r\n/g, '\n');
71
+ return text;
72
+ };
73
+ const compareText = (contentA, contentB)=>enforceLFLineSeparators(contentA) === enforceLFLineSeparators(contentB);
74
+ const validModes = [
75
+ 'emit',
76
+ 'verify'
77
+ ];
78
+ const isFileNotFound = (err)=>err && 'ENOENT' === err.code;
79
+ const makeDoneHandlers = (callback, content, rest)=>({
80
+ failed: (e)=>callback(e),
81
+ success: ()=>callback(null, content, ...rest)
54
82
  });
55
- const external_node_fs_namespaceObject = require("node:fs");
56
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
57
- const external_node_path_namespaceObject = require("node:path");
58
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
59
- const external_constants_cjs_namespaceObject = require("../constants.cjs");
60
- const external_utils_cjs_namespaceObject = require("./utils.cjs");
61
- const LineDiff = __webpack_require__("../../compiled/line-diff/index.js");
62
- const isInNodeModules = (path)=>external_constants_cjs_namespaceObject.NODE_MODULES_REGEX.test(path);
63
- const getNoDeclarationFileError = ({ filename })=>new Error(`Generated type declaration does not exist. Run dev and commit the type declaration for '${filename}'`);
64
- const getTypeMismatchError = ({ filename, expected, actual })=>{
65
- const diff = new LineDiff(enforceLFLineSeparators(actual), expected).toString();
66
- return new Error(`Generated type declaration file is outdated. Run dev and commit the updated type declaration for '${filename}'\n\n${diff}`);
67
- };
68
- function wrapQuotes(key) {
69
- const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
70
- if (isValidIdentifier) return key;
71
- return `'${key}'`;
72
- }
73
- const cssModuleToNamedExports = (cssModuleKeys)=>cssModuleKeys.sort().map((key)=>`export const ${key}: string;`).join('\n');
74
- const cssModuleToInterface = (cssModulesKeys)=>{
75
- const interfaceFields = cssModulesKeys.sort().map((key)=>` ${wrapQuotes(key)}: string;`).join('\n');
76
- return `interface CssExports {\n${interfaceFields}\n}`;
77
- };
78
- const filenameToTypingsFilename = (filename)=>{
79
- const dirName = external_node_path_default().dirname(filename);
80
- const baseName = external_node_path_default().basename(filename);
81
- return external_node_path_default().join(dirName, `${baseName}.d.ts`);
82
- };
83
- const enforceLFLineSeparators = (text)=>{
84
- if (text) return text.replace(/\r\n/g, '\n');
85
- return text;
86
- };
87
- const compareText = (contentA, contentB)=>enforceLFLineSeparators(contentA) === enforceLFLineSeparators(contentB);
88
- const validModes = [
89
- 'emit',
90
- 'verify'
91
- ];
92
- const isFileNotFound = (err)=>err && 'ENOENT' === err.code;
93
- const makeDoneHandlers = (callback, content, rest)=>({
94
- failed: (e)=>callback(e),
95
- success: ()=>callback(null, content, ...rest)
96
- });
97
- const makeFileHandlers = (filename)=>({
98
- read: (handler)=>external_node_fs_default().readFile(filename, {
99
- encoding: 'utf-8'
100
- }, handler),
101
- write: (content, handler)=>external_node_fs_default().writeFile(filename, content, {
102
- encoding: 'utf-8'
103
- }, handler)
104
- });
105
- const extractLocalExports = (content)=>{
106
- let localExports = content.split('exports.locals')[1];
107
- if (!localExports) localExports = content.split('___CSS_LOADER_EXPORT___.locals')[1];
108
- return localExports;
109
- };
110
- const getCSSModulesKeys = (content, namedExport)=>{
111
- const keys = new Set();
112
- if (namedExport) {
113
- const exportsRegex = /export\s+var\s+(\w+)\s*=/g;
114
- let match = exportsRegex.exec(content);
115
- while(null !== match){
116
- keys.add(match[1]);
117
- match = exportsRegex.exec(content);
118
- }
119
- return Array.from(keys);
120
- }
121
- const localExports = extractLocalExports(content);
122
- const keyRegex = /"([^\\"]+)":/g;
123
- let match = keyRegex.exec(localExports);
83
+ const makeFileHandlers = (filename)=>({
84
+ read: (handler)=>external_node_fs_default().readFile(filename, {
85
+ encoding: 'utf-8'
86
+ }, handler),
87
+ write: (content, handler)=>external_node_fs_default().writeFile(filename, content, {
88
+ encoding: 'utf-8'
89
+ }, handler)
90
+ });
91
+ const extractLocalExports = (content)=>{
92
+ let localExports = content.split('exports.locals')[1];
93
+ if (!localExports) localExports = content.split('___CSS_LOADER_EXPORT___.locals')[1];
94
+ return localExports;
95
+ };
96
+ const getCSSModulesKeys = (content, namedExport)=>{
97
+ const keys = new Set();
98
+ if (namedExport) {
99
+ const exportsRegex = /export\s+var\s+(\w+)\s*=/g;
100
+ let match = exportsRegex.exec(content);
124
101
  while(null !== match){
125
102
  keys.add(match[1]);
126
- match = keyRegex.exec(localExports);
103
+ match = exportsRegex.exec(content);
127
104
  }
128
105
  return Array.from(keys);
129
- };
130
- function codegen(keys, namedExport) {
131
- const bannerMessage = '// Generated automatically, do not edit';
132
- if (namedExport) return `${bannerMessage}\n${cssModuleToNamedExports(keys)}\n`;
133
- const cssModuleExport = 'declare const cssExports: CssExports;\nexport default cssExports;\n';
134
- return `${bannerMessage}\n${cssModuleToInterface(keys)}\n${cssModuleExport}`;
135
106
  }
136
- function loader(content, ...rest) {
137
- const { failed, success } = makeDoneHandlers(this.async(), content, rest);
138
- const { resourcePath } = this;
139
- const { mode = 'emit', modules } = this.getOptions() || {};
140
- if (!validModes.includes(mode)) return void failed(new Error(`Invalid mode option: ${mode}`));
141
- if (!(0, external_utils_cjs_namespaceObject.isCSSModules)({
142
- resourcePath,
143
- modules
144
- }) || isInNodeModules(resourcePath)) return void success();
145
- const cssModuleInterfaceFilename = filenameToTypingsFilename(resourcePath);
146
- const { read, write } = makeFileHandlers(cssModuleInterfaceFilename);
147
- const namedExport = external_constants_cjs_namespaceObject.CSS_NAMED_EXPORT;
148
- const cssModulesKeys = getCSSModulesKeys(content, namedExport);
149
- const cssModulesCode = codegen(cssModulesKeys, namedExport);
150
- read('verify' === mode ? (err, fileContents)=>{
151
- if (isFileNotFound(err)) return failed(getNoDeclarationFileError({
152
- filename: cssModuleInterfaceFilename
153
- }));
154
- if (err) return failed(err);
155
- if (!compareText(cssModulesCode, fileContents)) return failed(getTypeMismatchError({
156
- filename: cssModuleInterfaceFilename,
157
- expected: cssModulesCode,
158
- actual: fileContents
159
- }));
160
- return success();
161
- } : (_, fileContents)=>{
162
- if (compareText(cssModulesCode, fileContents)) success();
163
- else write(cssModulesCode, (err)=>{
164
- if (err) failed(err);
165
- else success();
166
- });
167
- });
107
+ const localExports = extractLocalExports(content);
108
+ const keyRegex = /"([^\\"]+)":/g;
109
+ let match = keyRegex.exec(localExports);
110
+ while(null !== match){
111
+ keys.add(match[1]);
112
+ match = keyRegex.exec(localExports);
168
113
  }
169
- })();
114
+ return Array.from(keys);
115
+ };
116
+ function codegen(keys, namedExport) {
117
+ const bannerMessage = '// Generated automatically, do not edit';
118
+ if (namedExport) return `${bannerMessage}\n${cssModuleToNamedExports(keys)}\n`;
119
+ const cssModuleExport = 'declare const cssExports: CssExports;\nexport default cssExports;\n';
120
+ return `${bannerMessage}\n${cssModuleToInterface(keys)}\n${cssModuleExport}`;
121
+ }
122
+ function loader(content, ...rest) {
123
+ const { failed, success } = makeDoneHandlers(this.async(), content, rest);
124
+ const { resourcePath } = this;
125
+ const { mode = 'emit', modules } = this.getOptions() || {};
126
+ if (!validModes.includes(mode)) return void failed(new Error(`Invalid mode option: ${mode}`));
127
+ if (!(0, external_utils_cjs_namespaceObject.isCSSModules)({
128
+ resourcePath,
129
+ modules
130
+ }) || isInNodeModules(resourcePath)) return void success();
131
+ const cssModuleInterfaceFilename = filenameToTypingsFilename(resourcePath);
132
+ const { read, write } = makeFileHandlers(cssModuleInterfaceFilename);
133
+ const namedExport = external_constants_cjs_namespaceObject.CSS_NAMED_EXPORT;
134
+ const cssModulesKeys = getCSSModulesKeys(content, namedExport);
135
+ const cssModulesCode = codegen(cssModulesKeys, namedExport);
136
+ read('verify' === mode ? (err, fileContents)=>{
137
+ if (isFileNotFound(err)) return failed(getNoDeclarationFileError({
138
+ filename: cssModuleInterfaceFilename
139
+ }));
140
+ if (err) return failed(err);
141
+ if (!compareText(cssModulesCode, fileContents)) return failed(getTypeMismatchError({
142
+ filename: cssModuleInterfaceFilename,
143
+ expected: cssModulesCode,
144
+ actual: fileContents
145
+ }));
146
+ return success();
147
+ } : (_, fileContents)=>{
148
+ if (compareText(cssModulesCode, fileContents)) success();
149
+ else write(cssModulesCode, (err)=>{
150
+ if (err) failed(err);
151
+ else success();
152
+ });
153
+ });
154
+ }
170
155
  exports["default"] = __webpack_exports__["default"];
171
156
  exports.isInNodeModules = __webpack_exports__.isInNodeModules;
172
157
  exports.wrapQuotes = __webpack_exports__.wrapQuotes;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/typed-css-modules/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKnD,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAA;AAC7D,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,YAAkC,CAAA;AAuB9E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ9C;AAmGD,MAAM,CAAC,OAAO,WACZ,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAC,EACF,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,IAAI,CAgEN"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/typed-css-modules/loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGnD,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAA;AAC7D,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,YAAkC,CAAA;AAuB9E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ9C;AAmGD,MAAM,CAAC,OAAO,WACZ,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAC,EACF,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,IAAI,CAgEN"}
@@ -1,30 +1,14 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_line_diff_index_js_2f8a9adc__ from "../../compiled/line-diff/index.js";
4
3
  import node_fs from "node:fs";
5
4
  import node_path from "node:path";
5
+ import line_diff from "line-diff";
6
6
  import { CSS_NAMED_EXPORT, NODE_MODULES_REGEX } from "../constants.js";
7
7
  import { isCSSModules } from "./utils.js";
8
- var __webpack_modules__ = {
9
- "../../compiled/line-diff/index.js": function(module) {
10
- module.exports = __WEBPACK_EXTERNAL_MODULE__compiled_line_diff_index_js_2f8a9adc__;
11
- }
12
- };
13
- var __webpack_module_cache__ = {};
14
- function __webpack_require__(moduleId) {
15
- var cachedModule = __webpack_module_cache__[moduleId];
16
- if (void 0 !== cachedModule) return cachedModule.exports;
17
- var module = __webpack_module_cache__[moduleId] = {
18
- exports: {}
19
- };
20
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
21
- return module.exports;
22
- }
23
- const LineDiff = __webpack_require__("../../compiled/line-diff/index.js");
24
8
  const isInNodeModules = (path)=>NODE_MODULES_REGEX.test(path);
25
9
  const getNoDeclarationFileError = ({ filename })=>new Error(`Generated type declaration does not exist. Run dev and commit the type declaration for '${filename}'`);
26
10
  const getTypeMismatchError = ({ filename, expected, actual })=>{
27
- const diff = new LineDiff(enforceLFLineSeparators(actual), expected).toString();
11
+ const diff = new line_diff(enforceLFLineSeparators(actual), expected).toString();
28
12
  return new Error(`Generated type declaration file is outdated. Run dev and commit the updated type declaration for '${filename}'\n\n${diff}`);
29
13
  };
30
14
  function wrapQuotes(key) {
@@ -128,7 +128,7 @@ export type UnpackConfig = {
128
128
  /**
129
129
  * Ignore CSS files from specified dependencies in prebundle output.
130
130
  */
131
- ignoreCss?: string[];
131
+ ignoreCSS?: string[];
132
132
  };
133
133
  };
134
134
  build?: {
package/dist/utils.cjs CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
- "../compiled/portfinder/index.js": function(module) {
4
- module.exports = require("../compiled/portfinder/index.js");
5
- },
6
3
  "../compiled/webpack-merge/index.js": function(module) {
7
4
  module.exports = require("../compiled/webpack-merge/index.js");
8
5
  }
@@ -92,11 +89,12 @@ var __webpack_exports__ = {};
92
89
  var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
93
90
  const external_node_path_namespaceObject = require("node:path");
94
91
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
92
+ const external_portfinder_namespaceObject = require("portfinder");
93
+ var external_portfinder_default = /*#__PURE__*/ __webpack_require__.n(external_portfinder_namespaceObject);
95
94
  const external_colors_cjs_namespaceObject = require("./colors.cjs");
96
95
  const external_constants_cjs_namespaceObject = require("./constants.cjs");
97
96
  const external_logger_cjs_namespaceObject = require("./logger.cjs");
98
97
  const { merge } = __webpack_require__("../compiled/webpack-merge/index.js");
99
- const portfinder = __webpack_require__("../compiled/portfinder/index.js");
100
98
  const getNodeEnv = ()=>process.env.NODE_ENV;
101
99
  const setNodeEnv = (env)=>{
102
100
  process.env.NODE_ENV = env;
@@ -146,7 +144,7 @@ var __webpack_exports__ = {};
146
144
  current[pathArray.at(-1)] = value;
147
145
  };
148
146
  const getPort = (startPort = 45678)=>new Promise((resolve)=>{
149
- portfinder.getPort({
147
+ external_portfinder_default().getPort({
150
148
  port: startPort
151
149
  }, (_, port)=>{
152
150
  resolve(port);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,SAAS,CAAA;AAKxB,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAK7D,eAAO,MAAM,UAAU,QAAiC,OAAO,CAAA;AAE/D,eAAO,MAAM,UAAU,GAAI,KAAK,OAAO,SAEtC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,aAAa,OAAO,SAEhD,CAAA;AAED,eAAO,MAAM,KAAK,QAAO,OAAyC,CAAA;AAElE,eAAO,MAAM,WAAW,QAAO,OAA4C,CAAA;AAE3E,eAAO,MAAM,OAAO,QA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AM,MAAM,GAAG,MAAM,EAAE,KAAG,MAAM,GAAG,SAQ/E,CAAA;AAED,wBAAgB,OAAO,WAMtB;AAED,eAAO,MAAM,QAAQ,GAAI,OAAE,EAAE,UAAK,MAExB,GAAG,WAAI,SAMhB,CAAA;AAED,eAAO,MAAM,iBAAiB,iCAgB7B,CAAA;AAoBD,KAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhD,eAAO,MAAM,cAAc,GAAI,2BAI5B;IACD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,KAAG,UAAU,EAuCb,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,SAY5C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,WAE1C,CAAA;AAED,eAAO,MAAM,WAAW,KAAQ,CAAA;AAEhC,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,QAK1D,CAAA;AAED,eAAO,MAAM,SAAS,YAIrB,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,SAGvC,CAAA;AAED,eAAO,MAAM,OAAO,eAEnB,CAAA"}
package/dist/utils.js CHANGED
@@ -2,19 +2,16 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
4
4
  import { dirname as __webpack_dirname__ } from "node:path";
5
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_portfinder_index_js_249feeee__ from "../compiled/portfinder/index.js";
6
5
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_webpack_merge_index_js_efd91626__ from "../compiled/webpack-merge/index.js";
7
6
  import node_fs from "node:fs";
8
7
  import node_net from "node:net";
9
8
  import node_os from "node:os";
10
9
  import node_path from "node:path";
10
+ import portfinder from "portfinder";
11
11
  import { colors } from "./colors.js";
12
12
  import { DEFAULT_DEV_HOST } from "./constants.js";
13
13
  import { logger } from "./logger.js";
14
14
  var __webpack_modules__ = {
15
- "../compiled/portfinder/index.js": function(module) {
16
- module.exports = __WEBPACK_EXTERNAL_MODULE__compiled_portfinder_index_js_249feeee__;
17
- },
18
15
  "../compiled/webpack-merge/index.js": function(module) {
19
16
  module.exports = __WEBPACK_EXTERNAL_MODULE__compiled_webpack_merge_index_js_efd91626__;
20
17
  }
@@ -31,7 +28,6 @@ function __webpack_require__(moduleId) {
31
28
  }
32
29
  var utils_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
33
30
  const { merge } = __webpack_require__("../compiled/webpack-merge/index.js");
34
- const portfinder = __webpack_require__("../compiled/portfinder/index.js");
35
31
  const getNodeEnv = ()=>process.env.NODE_ENV;
36
32
  const setNodeEnv = (env)=>{
37
33
  process.env.NODE_ENV = env;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/core",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,10 +9,6 @@
9
9
  "import": "./dist/index.js",
10
10
  "require": "./dist/index.cjs"
11
11
  },
12
- "./portfinder": {
13
- "types": "./compiled/portfinder/index.d.ts",
14
- "default": "./compiled/portfinder/index.js"
15
- },
16
12
  "./webpack-merge": {
17
13
  "types": "./compiled/webpack-merge/index.d.ts",
18
14
  "default": "./compiled/webpack-merge/index.js"
@@ -41,10 +37,6 @@
41
37
  "types": "./compiled/webpack-bundle-analyzer/index.d.ts",
42
38
  "default": "./compiled/webpack-bundle-analyzer/index.js"
43
39
  },
44
- "./line-diff": {
45
- "types": "./compiled/line-diff/index.d.ts",
46
- "default": "./compiled/line-diff/index.js"
47
- },
48
40
  "./style-loader": {
49
41
  "types": "./compiled/style-loader/index.d.ts",
50
42
  "default": "./compiled/style-loader/index.js"
@@ -67,8 +59,6 @@
67
59
  "@types/sass-loader": "8.0.9",
68
60
  "css-loader": "7.1.2",
69
61
  "less-loader": "12.3.0",
70
- "line-diff": "2.1.2",
71
- "portfinder": "1.0.37",
72
62
  "postcss-loader": "8.1.1",
73
63
  "sass-loader": "16.0.5",
74
64
  "semver": "7.7.2",
@@ -77,7 +67,9 @@
77
67
  "webpack-merge": "6.0.1"
78
68
  },
79
69
  "dependencies": {
80
- "@rspack/core": "1.4.0",
70
+ "line-diff": "2.1.2",
71
+ "portfinder": "1.0.37",
72
+ "@rspack/core": "1.4.2",
81
73
  "@types/less": "3.0.8",
82
74
  "chokidar": "4.0.3",
83
75
  "copy-webpack-plugin": "13.0.0",
@@ -1 +0,0 @@
1
- export = any;
@@ -1,160 +0,0 @@
1
- (() => {
2
- var __webpack_modules__ = {
3
- 445: (module) => {
4
- module.exports = function (s, t) {
5
- var d = [];
6
- var n = s.length;
7
- var m = t.length;
8
- if (n == 0) return m;
9
- if (m == 0) return n;
10
- for (var i = n; i >= 0; i--) d[i] = [];
11
- for (var i = n; i >= 0; i--) d[i][0] = i;
12
- for (var j = m; j >= 0; j--) d[0][j] = j;
13
- for (var i = 1; i <= n; i++) {
14
- var s_i = s.charAt(i - 1);
15
- for (var j = 1; j <= m; j++) {
16
- if (i == j && d[i][j] > 4) return n;
17
- var t_j = t.charAt(j - 1);
18
- var cost = s_i == t_j ? 0 : 1;
19
- var mi = d[i - 1][j] + 1;
20
- var b = d[i][j - 1] + 1;
21
- var c = d[i - 1][j - 1] + cost;
22
- if (b < mi) mi = b;
23
- if (c < mi) mi = c;
24
- d[i][j] = mi;
25
- if (
26
- i > 1 &&
27
- j > 1 &&
28
- s_i == t.charAt(j - 2) &&
29
- s.charAt(i - 2) == t_j
30
- ) {
31
- d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);
32
- }
33
- }
34
- }
35
- return d[n][m];
36
- };
37
- },
38
- 83: (module, __unused_webpack_exports, __nccwpck_require__) => {
39
- "use strict";
40
- var _createClass = (function () {
41
- function defineProperties(target, props) {
42
- for (var i = 0; i < props.length; i++) {
43
- var descriptor = props[i];
44
- descriptor.enumerable = descriptor.enumerable || false;
45
- descriptor.configurable = true;
46
- if ("value" in descriptor) descriptor.writable = true;
47
- Object.defineProperty(target, descriptor.key, descriptor);
48
- }
49
- }
50
- return function (Constructor, protoProps, staticProps) {
51
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
52
- if (staticProps) defineProperties(Constructor, staticProps);
53
- return Constructor;
54
- };
55
- })();
56
- function _classCallCheck(instance, Constructor) {
57
- if (!(instance instanceof Constructor)) {
58
- throw new TypeError("Cannot call a class as a function");
59
- }
60
- }
61
- var LevDist = __nccwpck_require__(445);
62
- var Change =
63
- /*!
64
- * Change
65
- * This is used for comparing two lines.
66
- *
67
- * @name Change
68
- * @function
69
- * @param {String} oldLine The old line value.
70
- * @param {String} addedLine The new line.
71
- * @param {Number} sensitivity The diff sensitivity.
72
- * @return {Change} The `Change` object:
73
- *
74
- * - `_` (Array): An array with the old line and the new line.
75
- * - `changes` (Number): How many changes are there, calculated with the levenshtein distance algorithm.
76
- * - `modified` (Boolean): A boolean value representing if the old line was modified or not.
77
- */
78
- function Change(oldLine, addedLine, sensitivity, lineno) {
79
- _classCallCheck(this, Change);
80
- this._ = [oldLine, addedLine];
81
- this.changes = LevDist(oldLine, addedLine);
82
- this.modified = this.changes > sensitivity;
83
- this.lineno = lineno;
84
- };
85
- var Diff = (function () {
86
- function Diff(oldLines, newLines, sensitivity) {
87
- var _this = this;
88
- _classCallCheck(this, Diff);
89
- this.sensitivity = sensitivity || 0;
90
- this.changes = [];
91
- oldLines =
92
- typeof oldLines === "string" ? oldLines.split("\n") : oldLines;
93
- newLines =
94
- typeof newLines === "string" ? newLines.split("\n") : newLines;
95
- this.old_lines = oldLines;
96
- this.new_lines = newLines;
97
- var cOldLine = null;
98
- newLines.forEach(function (cNewLine, i) {
99
- cOldLine = oldLines[i] || "";
100
- _this.changes.push(
101
- new Change(cOldLine, cNewLine, _this.sensitivity, i + 1),
102
- );
103
- });
104
- }
105
- _createClass(Diff, [
106
- {
107
- key: "toString",
108
- value: function toString() {
109
- var str = "",
110
- cDiff = { added: "", removed: "" };
111
- this.changes.forEach(function (cChange) {
112
- if (!cChange.modified) {
113
- str += cDiff.removed;
114
- str += cDiff.added;
115
- cDiff.removed = "";
116
- cDiff.added = "";
117
- str += " " + cChange._[1] + "\n";
118
- } else {
119
- cDiff.removed += " - " + cChange._[0] + "\n";
120
- if (cChange._[1]) {
121
- cDiff.added += " + " + cChange._[1] + "\n";
122
- }
123
- }
124
- });
125
- str += cDiff.removed;
126
- str += cDiff.added;
127
- return str;
128
- },
129
- },
130
- ]);
131
- return Diff;
132
- })();
133
- module.exports = Diff;
134
- },
135
- };
136
- var __webpack_module_cache__ = {};
137
- function __nccwpck_require__(moduleId) {
138
- var cachedModule = __webpack_module_cache__[moduleId];
139
- if (cachedModule !== undefined) {
140
- return cachedModule.exports;
141
- }
142
- var module = (__webpack_module_cache__[moduleId] = { exports: {} });
143
- var threw = true;
144
- try {
145
- __webpack_modules__[moduleId](
146
- module,
147
- module.exports,
148
- __nccwpck_require__,
149
- );
150
- threw = false;
151
- } finally {
152
- if (threw) delete __webpack_module_cache__[moduleId];
153
- }
154
- return module.exports;
155
- }
156
- if (typeof __nccwpck_require__ !== "undefined")
157
- __nccwpck_require__.ab = __dirname + "/";
158
- var __webpack_exports__ = __nccwpck_require__(83);
159
- module.exports = __webpack_exports__;
160
- })();
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015-25 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1 +0,0 @@
1
- {"name":"line-diff","author":"Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)","version":"2.1.2","license":"MIT","types":"index.d.ts","type":"commonjs"}