@modern-js/node-bundle-require 1.2.1 → 1.2.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.
@@ -5,9 +5,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import path from 'path';
8
- import { randomUUID } from 'crypto';
9
8
  import { fs } from '@modern-js/utils';
10
9
  import { build } from 'esbuild';
10
+ import { nanoid } from 'nanoid';
11
11
  const JS_EXT_RE = /\.(mjs|cjs|ts|js|tsx|jsx)$/; // Must not start with "/" or "./" or "../"
12
12
  // "/test/node_modules/foo"
13
13
  // "c:/node_modules/foo"
@@ -23,9 +23,7 @@ function inferLoader(ext) {
23
23
  return ext.slice(1);
24
24
  }
25
25
 
26
- const defaultGetOutputFile = filepath => path.resolve(CACHE_DIR, `${filepath}-${Date.now()}.${randomUUID({
27
- disableEntropyCache: true
28
- })}.bundled.cjs`);
26
+ const defaultGetOutputFile = filepath => path.resolve(CACHE_DIR, `${filepath}-${Date.now()}.${nanoid()}.bundled.cjs`);
29
27
 
30
28
  export async function bundleRequire(filepath, options) {
31
29
  if (!JS_EXT_RE.test(filepath)) {
@@ -8,12 +8,12 @@ exports.bundleRequire = bundleRequire;
8
8
 
9
9
  var _path = _interopRequireDefault(require("path"));
10
10
 
11
- var _crypto = require("crypto");
12
-
13
11
  var _utils = require("@modern-js/utils");
14
12
 
15
13
  var _esbuild = require("esbuild");
16
14
 
15
+ var _nanoid = require("nanoid");
16
+
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -39,9 +39,7 @@ function inferLoader(ext) {
39
39
  return ext.slice(1);
40
40
  }
41
41
 
42
- const defaultGetOutputFile = filepath => _path.default.resolve(CACHE_DIR, `${filepath}-${Date.now()}.${(0, _crypto.randomUUID)({
43
- disableEntropyCache: true
44
- })}.bundled.cjs`);
42
+ const defaultGetOutputFile = filepath => _path.default.resolve(CACHE_DIR, `${filepath}-${Date.now()}.${(0, _nanoid.nanoid)()}.bundled.cjs`);
45
43
 
46
44
  async function bundleRequire(filepath, options) {
47
45
  if (!JS_EXT_RE.test(filepath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/node-bundle-require",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
5
5
  "homepage": "https://modernjs.dev",
6
6
  "bugs": "https://github.com/modern-js-dev/modern.js/issues",
@@ -29,7 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "esbuild": "^0.13.8"
32
+ "esbuild": "^0.13.8",
33
+ "nanoid": "^3.3.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@scripts/build": "0.0.0",