@knighted/module 1.0.0-alpha.5 → 1.0.0-alpha.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.
- package/dist/cjs/format.cjs +8 -1
- package/dist/format.js +9 -1
- package/package.json +5 -3
package/dist/cjs/format.cjs
CHANGED
|
@@ -6,11 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.format = void 0;
|
|
7
7
|
var _magicString = _interopRequireDefault(require("magic-string"));
|
|
8
8
|
var _traverse2 = _interopRequireDefault(require("@babel/traverse"));
|
|
9
|
+
var _nodeModuleType = require("node-module-type");
|
|
9
10
|
var _identifier = require("./formatters/identifier.cjs");
|
|
10
11
|
var _metaProperty = require("./formatters/metaProperty.cjs");
|
|
11
12
|
var _memberExpression = require("./formatters/memberExpression.cjs");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Runtime hack to prevent issues with babel's default interop while dual building with tsc.
|
|
16
|
+
* @see https://github.com/babel/babel/discussions/13093#discussioncomment-12705927
|
|
17
|
+
* Temporary fix until I switch to oxc-parser.
|
|
18
|
+
*/
|
|
19
|
+
const type = (0, _nodeModuleType.moduleType)();
|
|
20
|
+
const traverse = typeof _traverse2.default === 'function' || type === 'commonjs' ? _traverse2.default : _traverse2.default.default;
|
|
14
21
|
|
|
15
22
|
/**
|
|
16
23
|
* Note, there is no specific conversion for `import.meta.main` as it does not exist.
|
package/dist/format.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import MagicString from 'magic-string';
|
|
2
2
|
import _traverse from '@babel/traverse';
|
|
3
|
+
import { moduleType } from 'node-module-type';
|
|
3
4
|
import { identifier } from './formatters/identifier.js';
|
|
4
5
|
import { metaProperty } from './formatters/metaProperty.js';
|
|
5
6
|
import { memberExpression } from './formatters/memberExpression.js';
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Runtime hack to prevent issues with babel's default interop while dual building with tsc.
|
|
10
|
+
* @see https://github.com/babel/babel/discussions/13093#discussioncomment-12705927
|
|
11
|
+
* Temporary fix until I switch to oxc-parser.
|
|
12
|
+
*/
|
|
13
|
+
const type = moduleType();
|
|
14
|
+
const traverse = typeof _traverse === 'function' || type === 'commonjs' ? _traverse : _traverse.default;
|
|
7
15
|
|
|
8
16
|
/**
|
|
9
17
|
* Note, there is no specific conversion for `import.meta.main` as it does not exist.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knighted/module",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Converts module differences in source files between ES and CommonJS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/module.js",
|
|
@@ -75,8 +75,10 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@babel/parser": "^7.27.0",
|
|
77
77
|
"@babel/traverse": "^7.27.0",
|
|
78
|
-
"@knighted/specifier": "^2.0.
|
|
79
|
-
"
|
|
78
|
+
"@knighted/specifier": "^2.0.3",
|
|
79
|
+
"@knighted/walk": "^1.0.0-rc.1",
|
|
80
|
+
"magic-string": "^0.30.10",
|
|
81
|
+
"node-module-type": "^1.0.2"
|
|
80
82
|
},
|
|
81
83
|
"prettier": {
|
|
82
84
|
"arrowParens": "avoid",
|