@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 +1 -1
- package/dist/cjs/scopeNodes.d.cts +2 -0
- package/dist/cjs/utils/identifiers.cjs +2 -2
- package/dist/cjs/utils/scopeNodes.cjs +7 -0
- package/dist/cjs/utils.cjs +2 -2
- package/dist/scopeNodes.d.ts +2 -0
- package/dist/src/utils/scopeNodes.d.ts +2 -0
- package/dist/utils/identifiers.js +1 -1
- package/dist/utils/scopeNodes.js +2 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/helpers/scope.cjs +0 -12
- package/dist/cjs/scope.d.cts +0 -6
- package/dist/helpers/scope.js +0 -7
- package/dist/scope.d.ts +0 -6
- package/dist/src/helpers/scope.d.ts +0 -6
package/README.md
CHANGED
|
@@ -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 (
|
|
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'];
|
package/dist/cjs/utils.cjs
CHANGED
|
@@ -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 (
|
|
281
|
+
if (_scopeNodes.scopeNodes.includes(type)) {
|
|
282
282
|
scopes.pop();
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -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
|
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
|
+
"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": ">=
|
|
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
|
-
};
|
package/dist/cjs/scope.d.cts
DELETED
package/dist/helpers/scope.js
DELETED
|
@@ -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