@modern-js/node-bundle-require 1.2.1 → 1.2.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @modern-js/1.0.0-rc.19
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 8491b6dd: fix: optimise "types" exports from plugin
8
+
9
+ ## 1.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 0f4b9b05: fix: release @modern-js/node-bundle-require for change randomUUID to nanoid
14
+
3
15
  ## 1.2.1
4
16
 
5
17
  ### Patch Changes
@@ -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)) {
@@ -49,7 +47,6 @@ export async function bundleRequire(filepath, options) {
49
47
  {
50
48
  name: 'native-node-modules',
51
49
 
52
- // eslint-disable-next-line @typescript-eslint/no-shadow
53
50
  setup(build) {
54
51
  // If a ".node" file is imported within a module in the "file" namespace, resolve
55
52
  // it to an absolute path and put it into the "node-file" virtual namespace.
@@ -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)) {
@@ -65,7 +63,6 @@ async function bundleRequire(filepath, options) {
65
63
  {
66
64
  name: 'native-node-modules',
67
65
 
68
- // eslint-disable-next-line @typescript-eslint/no-shadow
69
66
  setup(build) {
70
67
  // If a ".node" file is imported within a module in the "file" namespace, resolve
71
68
  // it to an absolute path and put it into the "node-file" virtual namespace.
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
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.4",
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,11 +29,12 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7",
32
- "esbuild": "^0.13.8"
32
+ "esbuild": "^0.13.15",
33
+ "nanoid": "^3.3.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@scripts/build": "0.0.0",
36
- "@modern-js/utils": "^1.2.2",
37
+ "@modern-js/utils": "^1.3.7",
37
38
  "@types/jest": "^26.0.9",
38
39
  "@types/node": "^14",
39
40
  "typescript": "^4",
@@ -48,8 +49,7 @@
48
49
  },
49
50
  "publishConfig": {
50
51
  "registry": "https://registry.npmjs.org/",
51
- "access": "public",
52
- "types": "./dist/types/index.d.ts"
52
+ "access": "public"
53
53
  },
54
54
  "scripts": {
55
55
  "new": "modern new",
@@ -1,2 +1,2 @@
1
1
  /// <reference types="@modern-js/module-tools/types" />
2
- /// <reference types="@modern-js/plugin-testing/type" />
2
+ /// <reference types="@modern-js/plugin-testing/types" />