@knighted/module 1.0.0-beta.3 → 1.0.0-beta.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/README.md CHANGED
@@ -22,7 +22,7 @@ By default `@knighted/module` transforms the one-to-one [differences between ES
22
22
 
23
23
  ## Requirements
24
24
 
25
- - Node >= 20.11.0
25
+ - Node >= 22.21.1
26
26
 
27
27
  ## Install
28
28
 
@@ -0,0 +1,2 @@
1
+ declare const scopeNodes: string[];
2
+ export { scopeNodes };
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.collectScopeIdentifiers = exports.collectModuleIdentifiers = void 0;
7
7
  var _walk = require("#walk");
8
- var _scope = require("#helpers/scope.js");
9
8
  var _identifier = require("#helpers/identifier.js");
9
+ var _scopeNodes = require("./scopeNodes.cjs");
10
10
  const collectScopeIdentifiers = (node, scopes) => {
11
11
  const {
12
12
  type
@@ -180,7 +180,7 @@ const collectModuleIdentifiers = async (ast, hoisting = true) => {
180
180
  const {
181
181
  type
182
182
  } = node;
183
- if (_scope.scopes.includes(type)) {
183
+ if (_scopeNodes.scopeNodes.includes(type)) {
184
184
  scopes.pop();
185
185
  }
186
186
  }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scopeNodes = void 0;
7
+ const scopeNodes = exports.scopeNodes = ['BlockStatement', 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression', 'ClassDeclaration', 'ClassExpression', 'ClassBody', 'StaticBlock'];
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.requireMainRgx = exports.isValidUrl = exports.getLangFromExt = exports.exportsRename = exports.collectScopeIdentifiers = exports.collectModuleIdentifiers = exports.collectCjsExports = void 0;
7
7
  var _nodePath = require("node:path");
8
8
  var _walk = require("./walk.cjs");
9
- var _scope = require("./helpers/scope.cjs");
10
9
  var _identifier = require("./helpers/identifier.cjs");
10
+ var _scopeNodes = require("./utils/scopeNodes.cjs");
11
11
  const getLangFromExt = filename => {
12
12
  const ext = (0, _nodePath.extname)(filename);
13
13
  if (ext.endsWith('.js')) {
@@ -278,7 +278,7 @@ const collectModuleIdentifiers = async (ast, hoisting = true) => {
278
278
  const {
279
279
  type
280
280
  } = node;
281
- if (_scope.scopes.includes(type)) {
281
+ if (_scopeNodes.scopeNodes.includes(type)) {
282
282
  scopes.pop();
283
283
  }
284
284
  }
@@ -0,0 +1,2 @@
1
+ declare const scopeNodes: string[];
2
+ export { scopeNodes };
@@ -0,0 +1,2 @@
1
+ declare const scopeNodes: string[];
2
+ export { scopeNodes };
@@ -1,6 +1,6 @@
1
1
  import { ancestorWalk } from '#walk';
2
- import { scopes as scopeNodes } from '#helpers/scope.js';
3
2
  import { identifier } from '#helpers/identifier.js';
3
+ import { scopeNodes } from './scopeNodes.js';
4
4
  const collectScopeIdentifiers = (node, scopes) => {
5
5
  const {
6
6
  type
@@ -0,0 +1,2 @@
1
+ const scopeNodes = ['BlockStatement', 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression', 'ClassDeclaration', 'ClassExpression', 'ClassBody', 'StaticBlock'];
2
+ export { scopeNodes };
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { extname } from 'node:path';
2
2
  import { ancestorWalk } from './walk.js';
3
- import { scopes as scopeNodes } from './helpers/scope.js';
4
3
  import { identifier } from './helpers/identifier.js';
4
+ import { scopeNodes } from './utils/scopeNodes.js';
5
5
  const getLangFromExt = filename => {
6
6
  const ext = extname(filename);
7
7
  if (ext.endsWith('.js')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knighted/module",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Transforms differences between ES modules and CommonJS.",
5
5
  "type": "module",
6
6
  "main": "dist/module.js",
@@ -27,7 +27,7 @@
27
27
  "#formatters/*.js": "./src/formatters/*.js"
28
28
  },
29
29
  "engines": {
30
- "node": ">=20.11.0"
30
+ "node": ">=22.21.1"
31
31
  },
32
32
  "engineStrict": true,
33
33
  "scripts": {
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.scopes = exports.scope = void 0;
7
- const scopes = exports.scopes = ['BlockStatement', 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression', 'ClassDeclaration', 'ClassExpression', 'ClassBody', 'StaticBlock'];
8
- const scope = exports.scope = {
9
- isScope(node) {
10
- return scopes.includes(node.type);
11
- }
12
- };
@@ -1,6 +0,0 @@
1
- import type { Node } from 'oxc-parser';
2
- declare const scopes: string[];
3
- declare const scope: {
4
- isScope(node: Node): boolean;
5
- };
6
- export { scopes, scope };
@@ -1,7 +0,0 @@
1
- const scopes = ['BlockStatement', 'FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression', 'ClassDeclaration', 'ClassExpression', 'ClassBody', 'StaticBlock'];
2
- const scope = {
3
- isScope(node) {
4
- return scopes.includes(node.type);
5
- }
6
- };
7
- export { scopes, scope };
package/dist/scope.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { Node } from 'oxc-parser';
2
- declare const scopes: string[];
3
- declare const scope: {
4
- isScope(node: Node): boolean;
5
- };
6
- export { scopes, scope };
@@ -1,6 +0,0 @@
1
- import type { Node } from 'oxc-parser';
2
- declare const scopes: string[];
3
- declare const scope: {
4
- isScope(node: Node): boolean;
5
- };
6
- export { scopes, scope };