prebundle 1.2.5 → 1.2.7

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.
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2011-2017 JP Richardson
3
+ Copyright (c) 2011-2024 JP Richardson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
6
6
  (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
@@ -1 +1 @@
1
- {"name":"fs-extra","author":"JP Richardson <jprichardson@gmail.com>","version":"11.2.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"fs-extra","author":"JP Richardson <jprichardson@gmail.com>","version":"11.3.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,16 +1,16 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 37: (module) => {
4
+ 857: (module) => {
5
5
  module.exports = require("os");
6
6
  },
7
- 282: (module) => {
7
+ 932: (module) => {
8
8
  module.exports = require("process");
9
9
  },
10
- 224: (module) => {
10
+ 18: (module) => {
11
11
  module.exports = require("tty");
12
12
  },
13
- 103: (module, __unused_webpack_exports, __nccwpck_require__) => {
13
+ 436: (module, __unused_webpack_exports, __nccwpck_require__) => {
14
14
  var __create = Object.create;
15
15
  var __defProp = Object.defineProperty;
16
16
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -50,9 +50,9 @@
50
50
  logger: () => logger,
51
51
  });
52
52
  module.exports = __toCommonJS(src_exports);
53
- var import_node_process = __toESM(__nccwpck_require__(282));
54
- var import_node_os = __toESM(__nccwpck_require__(37));
55
- var import_node_tty = __toESM(__nccwpck_require__(224));
53
+ var import_node_process = __toESM(__nccwpck_require__(932));
54
+ var import_node_os = __toESM(__nccwpck_require__(857));
55
+ var import_node_tty = __toESM(__nccwpck_require__(18));
56
56
  function hasFlag(
57
57
  flag,
58
58
  argv = globalThis.Deno
@@ -232,7 +232,7 @@
232
232
  ? supports_color_default.stdout.level
233
233
  : 0;
234
234
  var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
235
- var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
235
+ var anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
236
236
  var isErrorStackMessage = (message) =>
237
237
  errorStackRegExp.test(message) ||
238
238
  anonymousErrorStackRegExp.test(message);
@@ -375,6 +375,6 @@
375
375
  }
376
376
  if (typeof __nccwpck_require__ !== "undefined")
377
377
  __nccwpck_require__.ab = __dirname + "/";
378
- var __webpack_exports__ = __nccwpck_require__(103);
378
+ var __webpack_exports__ = __nccwpck_require__(436);
379
379
  module.exports = __webpack_exports__;
380
380
  })();
@@ -1 +1 @@
1
- {"name":"rslog","version":"1.2.2","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rslog","version":"1.2.3","types":"index.d.ts","type":"commonjs"}
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
2
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__ from "../compiled/fs-extra/index.js";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
5
- import * as __WEBPACK_EXTERNAL_MODULE__vercel_ncc__ from "@vercel/ncc";
6
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__ from "../compiled/fast-glob/index.js";
7
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__ from "../compiled/rslog/index.js";
8
- import * as __WEBPACK_EXTERNAL_MODULE_rollup_plugin_dts__ from "rollup-plugin-dts";
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__ from "../compiled/fs-extra/index.js";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__vercel_ncc_57e68fb3__ from "@vercel/ncc";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js_8d514d69__ from "../compiled/fast-glob/index.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__ from "../compiled/rslog/index.js";
8
+ import * as __WEBPACK_EXTERNAL_MODULE_rollup_plugin_dts_1c9650fc__ from "rollup-plugin-dts";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_rollup__ from "rollup";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_terser__ from "terser";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
12
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
12
13
  const DIST_DIR = 'compiled';
13
14
  const DEFAULT_EXTERNALS = {
14
- // ncc bundled wrong package.json, using external to avoid this problem
15
15
  './package.json': './package.json',
16
16
  '../package.json': './package.json',
17
17
  '../../package.json': './package.json'
@@ -57,32 +57,32 @@ const NODE_BUILTINS = [
57
57
  'zlib'
58
58
  ];
59
59
  const cwd = process.cwd();
60
- const helper_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url);
60
+ const helper_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
61
61
  function findDepPath(name) {
62
62
  try {
63
- let entry = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(helper_require.resolve((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(name), {
63
+ let entry = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(helper_require.resolve((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(name), {
64
64
  paths: [
65
65
  cwd
66
66
  ]
67
67
  }));
68
- while(!(0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(entry).endsWith('node_modules'))entry = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(entry);
69
- if (name.includes('/')) return (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(entry), name);
68
+ while(!(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(entry).endsWith('node_modules'))entry = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(entry);
69
+ if (name.includes('/')) return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(entry), name);
70
70
  return entry;
71
71
  } catch (err) {
72
72
  return null;
73
73
  }
74
74
  }
75
75
  const resolveConfig = async ()=>{
76
- const configPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(cwd, 'prebundle.config.mjs');
77
- const config = await import((0, __WEBPACK_EXTERNAL_MODULE_node_url__.pathToFileURL)(configPath).href);
76
+ const configPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, 'prebundle.config.mjs');
77
+ const config = await import((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(configPath).href);
78
78
  return config.default;
79
79
  };
80
80
  function parseTasks(dependencies, globalPrettier) {
81
81
  const result = [];
82
82
  for (const dep of dependencies){
83
83
  const depName = 'string' == typeof dep ? dep : dep.name;
84
- const importPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(cwd, DIST_DIR, depName);
85
- const distPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(cwd, DIST_DIR, depName);
84
+ const importPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, DIST_DIR, depName);
85
+ const distPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, DIST_DIR, depName);
86
86
  const depPath = findDepPath(depName);
87
87
  if (!depPath) throw new Error(`Failed to resolve dependency: ${depName}`);
88
88
  const depEntry = helper_require.resolve(depName, {
@@ -133,12 +133,9 @@ function pkgNameToAtTypes(name) {
133
133
  const mangled = name.replace(/^@([^\/]+)\/([^\/]+)/, '$1__$2');
134
134
  return `@types/${mangled}`;
135
135
  }
136
- /**
137
- * Find the direct type file for a given file path.
138
- * @param filepath
139
- */ function findDirectTypeFile(filepath) {
136
+ function findDirectTypeFile(filepath) {
140
137
  if (/\.d\.[cm]?ts/.test(filepath)) return filepath;
141
- const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.extname)(filepath);
138
+ const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(filepath);
142
139
  const base = filepath.slice(0, -ext.length);
143
140
  const _find = (list)=>{
144
141
  for (const f of list)try {
@@ -170,16 +167,15 @@ function pkgNameToAtTypes(name) {
170
167
  default:
171
168
  }
172
169
  }
173
- const { logger } = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__["default"];
170
+ const { logger } = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__["default"];
174
171
  function emitAssets(assets, distPath) {
175
172
  for (const key of Object.keys(assets)){
176
173
  const asset = assets[key];
177
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].outputFileSync((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(distPath, key), asset.source);
174
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].outputFileSync((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(distPath, key), asset.source);
178
175
  }
179
176
  }
180
177
  async function emitIndex(code, distPath, prettier) {
181
- const distIndex = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(distPath, 'index.js');
182
- // use terser to strip comments and use prettier to format the code
178
+ const distIndex = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(distPath, 'index.js');
183
179
  if (prettier) {
184
180
  const minimized = await (0, __WEBPACK_EXTERNAL_MODULE_terser__.minify)(code, {
185
181
  compress: false,
@@ -190,12 +186,12 @@ async function emitIndex(code, distPath, prettier) {
190
186
  const formatted = await (0, __WEBPACK_EXTERNAL_MODULE_prettier__.format)(minimized.code, {
191
187
  filepath: distIndex
192
188
  });
193
- await __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].outputFile(distIndex, formatted);
194
- } else await __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].outputFile(distIndex, code);
189
+ await __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].outputFile(distIndex, formatted);
190
+ } else await __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].outputFile(distIndex, code);
195
191
  }
196
192
  async function emitDts(task, externals) {
197
193
  const outputDefaultDts = ()=>{
198
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].outputFileSync((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'index.d.ts'), 'export = any;\n');
194
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].outputFileSync((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'index.d.ts'), 'export = any;\n');
199
195
  };
200
196
  if (task.ignoreDts) {
201
197
  outputDefaultDts();
@@ -203,21 +199,20 @@ async function emitDts(task, externals) {
203
199
  }
204
200
  const getTypes = (json)=>{
205
201
  var _json_exports;
206
- return json && (json.types || json.typing || json.typings || // for those who use `exports` only
207
- getTypes(null === (_json_exports = json.exports) || void 0 === _json_exports ? void 0 : _json_exports['.'])) || null;
202
+ return json && (json.types || json.typing || json.typings || getTypes(null === (_json_exports = json.exports) || void 0 === _json_exports ? void 0 : _json_exports['.'])) || null;
208
203
  };
209
204
  const getInput = ()=>{
210
- const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.depPath, 'package.json');
211
- const pkgJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].readJsonSync(pkgPath, 'utf-8');
205
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.depPath, 'package.json');
206
+ const pkgJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].readJsonSync(pkgPath, 'utf-8');
212
207
  const types = getTypes(pkgJson);
213
- if (types) return (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.depPath, types);
208
+ if (types) return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.depPath, types);
214
209
  const directTypeFile = findDirectTypeFile(task.depEntry);
215
210
  if (directTypeFile) return directTypeFile;
216
211
  const depTypesPath = findDepPath(`${pkgNameToAtTypes(task.depName)}/package.json`);
217
212
  if (!depTypesPath) return null;
218
- const depTypesPkg = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].readJsonSync(depTypesPath, 'utf-8');
213
+ const depTypesPkg = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].readJsonSync(depTypesPath, 'utf-8');
219
214
  const depTypes = getTypes(depTypesPkg);
220
- return depTypes ? (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(depTypesPath), depTypes) : null;
215
+ return depTypes ? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(depTypesPath), depTypes) : null;
221
216
  };
222
217
  const input = getInput();
223
218
  if (!input) {
@@ -233,28 +228,18 @@ async function emitDts(task, externals) {
233
228
  ...NODE_BUILTINS
234
229
  ],
235
230
  plugins: [
236
- (0, __WEBPACK_EXTERNAL_MODULE_rollup_plugin_dts__.dts)({
231
+ (0, __WEBPACK_EXTERNAL_MODULE_rollup_plugin_dts_1c9650fc__.dts)({
237
232
  respectExternal: true,
238
233
  compilerOptions: {
239
234
  skipLibCheck: true,
240
- // https://github.com/Swatinem/rollup-plugin-dts/issues/143,
241
- // but it will cause error when bundle ts which import another ts file.
242
235
  preserveSymlinks: false,
243
- // https://github.com/Swatinem/rollup-plugin-dts/issues/127
244
236
  composite: false,
245
- // https://github.com/Swatinem/rollup-plugin-dts/issues/113
246
237
  declarationMap: false,
247
- // Ensure ".d.ts" modules are generated
248
238
  declaration: true,
249
- // Skip ".js" generation
250
239
  noEmit: false,
251
240
  emitDeclarationOnly: true,
252
- // Skip code generation when error occurs
253
241
  noEmitOnError: true,
254
- // Avoid extra work
255
242
  checkJs: false,
256
- // Ensure we can parse the latest code
257
- // @ts-expect-error
258
243
  target: task.target
259
244
  }
260
245
  })
@@ -274,9 +259,9 @@ async function emitDts(task, externals) {
274
259
  }
275
260
  }
276
261
  function emitPackageJson(task, assets) {
277
- const packageJsonPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.depPath, 'package.json');
278
- const packageJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].readJsonSync(packageJsonPath, 'utf-8');
279
- const outputPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'package.json');
262
+ const packageJsonPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.depPath, 'package.json');
263
+ const packageJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].readJsonSync(packageJsonPath, 'utf-8');
264
+ const outputPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'package.json');
280
265
  const pickedPackageJson = pick(packageJson, [
281
266
  'name',
282
267
  'author',
@@ -293,26 +278,26 @@ function emitPackageJson(task, assets) {
293
278
  'type'
294
279
  ]));
295
280
  } catch {}
296
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].writeJSONSync(outputPath, pickedPackageJson);
281
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].writeJSONSync(outputPath, pickedPackageJson);
297
282
  }
298
283
  function emitLicense(task) {
299
- const licensePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.depPath, 'LICENSE');
300
- if (__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].existsSync(licensePath)) __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].copySync(licensePath, (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'license'));
284
+ const licensePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.depPath, 'LICENSE');
285
+ if (__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].existsSync(licensePath)) __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].copySync(licensePath, (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'license'));
301
286
  }
302
287
  function emitExtraFiles(task) {
303
288
  const { emitFiles } = task;
304
289
  for (const item of emitFiles){
305
- const path = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, item.path);
306
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].outputFileSync(path, item.content);
290
+ const path = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, item.path);
291
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].outputFileSync(path, item.content);
307
292
  }
308
293
  }
309
294
  function removeSourceMap(task) {
310
- const maps = __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__["default"].sync((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, '**/*.map'));
311
- for (const mapPath of maps)__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].removeSync(mapPath);
295
+ const maps = __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js_8d514d69__["default"].sync((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, '**/*.map'));
296
+ for (const mapPath of maps)__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].removeSync(mapPath);
312
297
  }
313
298
  function renameDistFolder(task) {
314
- const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'package.json');
315
- const pkgJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].readJsonSync(pkgPath, 'utf-8');
299
+ const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'package.json');
300
+ const pkgJson = __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].readJsonSync(pkgPath, 'utf-8');
316
301
  for (const key of [
317
302
  'types',
318
303
  'typing',
@@ -321,30 +306,33 @@ function renameDistFolder(task) {
321
306
  var _pkgJson_key;
322
307
  if (null === (_pkgJson_key = pkgJson[key]) || void 0 === _pkgJson_key ? void 0 : _pkgJson_key.startsWith('dist/')) {
323
308
  pkgJson[key] = pkgJson[key].replace('dist/', 'types/');
324
- const distFolder = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'dist');
325
- const typesFolder = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(task.distPath, 'types');
326
- if (__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].existsSync(distFolder)) __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].renameSync(distFolder, typesFolder);
309
+ const distFolder = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'dist');
310
+ const typesFolder = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(task.distPath, 'types');
311
+ if (__WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].existsSync(distFolder)) __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].renameSync(distFolder, typesFolder);
327
312
  }
328
313
  }
329
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].writeJSONSync(pkgPath, pkgJson);
314
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].writeJSONSync(pkgPath, pkgJson);
330
315
  }
331
316
  const pkgName = process.argv[2];
332
- async function prebundle(task) {
333
- let commonExternals = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
317
+ async function prebundle(task, commonExternals = {}) {
334
318
  if (pkgName && task.depName !== pkgName) return;
335
319
  logger.start(`prebundle: ${task.depName}`);
336
- __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js__["default"].removeSync(task.distPath);
320
+ __WEBPACK_EXTERNAL_MODULE__compiled_fs_extra_index_js_a27e5f9c__["default"].removeSync(task.distPath);
337
321
  if (task.beforeBundle) await task.beforeBundle(task);
338
322
  const mergedExternals = {
339
323
  ...DEFAULT_EXTERNALS,
340
324
  ...commonExternals,
341
325
  ...task.externals
342
326
  };
343
- const { code, assets } = await (0, __WEBPACK_EXTERNAL_MODULE__vercel_ncc__["default"])(task.depEntry, {
327
+ const nodeModulesPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(process.cwd(), 'node_modules');
328
+ const hasNodeModules = (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync)(nodeModulesPath);
329
+ const enableCache = !process.env.CI && hasNodeModules;
330
+ const { code, assets } = await (0, __WEBPACK_EXTERNAL_MODULE__vercel_ncc_57e68fb3__["default"])(task.depEntry, {
344
331
  minify: task.minify,
345
332
  target: task.target,
346
333
  externals: mergedExternals,
347
- assetBuilds: false
334
+ assetBuilds: false,
335
+ cache: !!enableCache && (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(nodeModulesPath, '.cache', 'ncc-cache')
348
336
  });
349
337
  await emitIndex(code, task.distPath, task.prettier);
350
338
  emitAssets(assets, task.distPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebundle",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rspack-contrib/prebundle"
@@ -23,22 +23,22 @@
23
23
  "bump": "npx bumpp"
24
24
  },
25
25
  "dependencies": {
26
- "@vercel/ncc": "0.38.1",
27
- "prettier": "^3.2.5",
28
- "rollup": "^4.17.1",
29
- "rollup-plugin-dts": "^6.1.0",
30
- "terser": "^5.31.2"
26
+ "@vercel/ncc": "0.38.3",
27
+ "prettier": "^3.4.2",
28
+ "rollup": "^4.30.1",
29
+ "rollup-plugin-dts": "^6.1.1",
30
+ "terser": "^5.37.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@rslib/core": "0.0.11",
33
+ "@rslib/core": "0.3.1",
34
34
  "@types/fs-extra": "^11.0.4",
35
- "@types/node": "18.x",
36
- "fast-glob": "^3.3.2",
37
- "fs-extra": "^11.2.0",
38
- "rslog": "^1.2.2",
39
- "typescript": "^5.4.2"
35
+ "@types/node": "22.10.7",
36
+ "fast-glob": "^3.3.3",
37
+ "fs-extra": "^11.3.0",
38
+ "rslog": "^1.2.3",
39
+ "typescript": "^5.7.3"
40
40
  },
41
- "packageManager": "pnpm@9.0.5",
41
+ "packageManager": "pnpm@9.15.4",
42
42
  "publishConfig": {
43
43
  "access": "public",
44
44
  "registry": "https://registry.npmjs.org/",