@tamagui/babel-plugin-fully-specified 1.101.7 → 1.102.0
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/index.js +98 -74
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/index.native.js +98 -121
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.js +97 -79
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +105 -91
- package/dist/esm/index.native.js +97 -121
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +6 -4
- package/src/__tests__/__snapshots__/index.test.ts.snap +21 -0
- package/src/__tests__/fixtures/force-extension/bar.js +1 -0
- package/src/__tests__/fixtures/force-extension/foo.js +1 -0
- package/src/__tests__/fixtures/multiple-extensions-exists/modules/module.cjs +2 -0
- package/src/__tests__/fixtures/multiple-extensions-exists/modules/module.js +2 -0
- package/src/__tests__/fixtures/multiple-extensions-exists/modules/module.mjs +4 -0
- package/src/__tests__/fixtures/multiple-extensions-exists/test.mjs +2 -0
- package/src/__tests__/fixtures/sample-project-1/modules/cjs-module.cjs +2 -0
- package/src/__tests__/fixtures/sample-project-1/modules/module.mjs +4 -0
- package/src/__tests__/fixtures/sample-project-1/node_modules/@my-org/my-pkg/lib/exampleFunction.js +3 -0
- package/src/__tests__/fixtures/sample-project-1/node_modules/@my-org/my-pkg/lib/index.js +1 -0
- package/src/__tests__/fixtures/sample-project-1/node_modules/@my-org/my-pkg/package.json +4 -0
- package/src/__tests__/fixtures/sample-project-1/node_modules/README.md +1 -0
- package/src/__tests__/fixtures/sample-project-1/test.mjs +13 -0
- package/src/__tests__/index.test.ts +139 -0
- package/src/index.ts +220 -140
- package/types/index.d.ts +14 -21
- package/types/index.d.ts.map +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -17,37 +17,84 @@ __export(src_exports, {
|
|
|
17
17
|
default: () => FullySpecified
|
|
18
18
|
});
|
|
19
19
|
module.exports = __toCommonJS(src_exports);
|
|
20
|
-
var import_node_fs = require("node:fs"), import_node_path = require("node:path")
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
var import_node_fs = require("node:fs"), import_node_path = require("node:path");
|
|
21
|
+
const DEFAULT_OPTIONS = {
|
|
22
|
+
ensureFileExists: !1,
|
|
23
|
+
esExtensionDefault: ".js",
|
|
24
|
+
tryExtensions: [".js", ".mjs", ".cjs"],
|
|
25
|
+
esExtensions: [".js", ".mjs", ".cjs"],
|
|
26
|
+
includePackages: []
|
|
27
|
+
};
|
|
28
|
+
function FullySpecified(api, rawOptions) {
|
|
29
|
+
api.assertVersion(7);
|
|
30
|
+
const options = { ...DEFAULT_OPTIONS, ...rawOptions }, importDeclarationVisitor = (path, state) => {
|
|
31
|
+
const filePath = state.file.opts.filename;
|
|
32
|
+
if (!filePath) return;
|
|
33
|
+
const { node } = path;
|
|
34
|
+
if (node.importKind === "type") return;
|
|
35
|
+
const originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
36
|
+
originalModuleSpecifier,
|
|
37
|
+
{
|
|
38
|
+
filePath,
|
|
39
|
+
options
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
43
|
+
}, exportDeclarationVisitor = (path, state) => {
|
|
44
|
+
const filePath = state.file.opts.filename;
|
|
45
|
+
if (!filePath) return;
|
|
46
|
+
const { node } = path;
|
|
47
|
+
if (node.exportKind === "type") return;
|
|
48
|
+
const source = node.source;
|
|
49
|
+
if (!source) return;
|
|
50
|
+
const originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
51
|
+
originalModuleSpecifier,
|
|
52
|
+
{
|
|
53
|
+
filePath,
|
|
54
|
+
options
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
name: "babel-plugin-fully-specified",
|
|
61
|
+
visitor: {
|
|
62
|
+
ImportDeclaration: importDeclarationVisitor,
|
|
63
|
+
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
64
|
+
ExportAllDeclaration: exportDeclarationVisitor,
|
|
65
|
+
Import: (path, state) => {
|
|
66
|
+
const filePath = state.file.opts.filename;
|
|
67
|
+
if (!filePath) return;
|
|
68
|
+
const parent = path.parent;
|
|
69
|
+
if (parent.type !== "CallExpression")
|
|
70
|
+
return;
|
|
71
|
+
const firstArgOfImportCall = parent.arguments[0];
|
|
72
|
+
if (firstArgOfImportCall.type !== "StringLiteral")
|
|
73
|
+
return;
|
|
74
|
+
const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
75
|
+
originalModuleSpecifier,
|
|
76
|
+
{
|
|
77
|
+
filePath,
|
|
78
|
+
options
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
87
|
+
filePath,
|
|
88
|
+
options
|
|
89
|
+
}) {
|
|
90
|
+
const fileExt = (0, import_node_path.extname)(filePath), fileDir = (0, import_node_path.dirname)(filePath), { includePackages } = options;
|
|
44
91
|
let packageData = null;
|
|
45
|
-
if (!isLocalFile(
|
|
46
|
-
return;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
filenameDirectory,
|
|
50
|
-
filenameExtension,
|
|
92
|
+
if (!isLocalFile(originalModuleSpecifier) && (includePackages.some((name) => originalModuleSpecifier.startsWith(name)) && (packageData = getPackageData(originalModuleSpecifier, filePath)), !(packageData && packageData.isDeepImport)))
|
|
93
|
+
return null;
|
|
94
|
+
const isDirectory = isLocalDirectory((0, import_node_path.resolve)(fileDir, originalModuleSpecifier)), currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
95
|
+
moduleSpecifier: originalModuleSpecifier,
|
|
96
|
+
filenameDirectory: fileDir,
|
|
97
|
+
filenameExtension: fileExt,
|
|
51
98
|
packageData,
|
|
52
99
|
currentModuleExtension,
|
|
53
100
|
isDirectory,
|
|
@@ -56,39 +103,13 @@ const makeDeclaration = ({
|
|
|
56
103
|
esExtensionDefault,
|
|
57
104
|
ensureFileExists
|
|
58
105
|
});
|
|
59
|
-
|
|
60
|
-
return;
|
|
61
|
-
const nodes = makeNodes(path);
|
|
62
|
-
path.replaceWith(
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
declaration.apply(null, [...nodes, (0, import_types.stringLiteral)(targetModule.module)])
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
function FullySpecified(api, options) {
|
|
68
|
-
return api.assertVersion(7), {
|
|
69
|
-
name: "babel-plugin-fully-specified",
|
|
70
|
-
visitor: {
|
|
71
|
-
ImportDeclaration: makeDeclaration({
|
|
72
|
-
...options,
|
|
73
|
-
declaration: import_types.importDeclaration,
|
|
74
|
-
makeNodes: ({ node: { specifiers } }) => [specifiers]
|
|
75
|
-
}),
|
|
76
|
-
ExportNamedDeclaration: makeDeclaration({
|
|
77
|
-
...options,
|
|
78
|
-
declaration: import_types.exportNamedDeclaration,
|
|
79
|
-
makeNodes: ({ node: { declaration, specifiers } }) => [declaration, specifiers]
|
|
80
|
-
}),
|
|
81
|
-
ExportAllDeclaration: makeDeclaration({
|
|
82
|
-
...options,
|
|
83
|
-
declaration: import_types.exportAllDeclaration,
|
|
84
|
-
makeNodes: () => []
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
};
|
|
106
|
+
return targetModule === !1 || currentModuleExtension === targetModule.extension ? null : targetModule.module;
|
|
88
107
|
}
|
|
89
|
-
function getPackageData(
|
|
108
|
+
function getPackageData(moduleSpecifier, filePath) {
|
|
90
109
|
try {
|
|
91
|
-
const
|
|
110
|
+
const modulePath = require.resolve(moduleSpecifier, {
|
|
111
|
+
paths: filePath ? [filePath] : []
|
|
112
|
+
}), parts = modulePath.split("/");
|
|
92
113
|
let packageDir = "";
|
|
93
114
|
for (let i = parts.length; i >= 0; i--) {
|
|
94
115
|
const dir = (0, import_node_path.dirname)(parts.slice(0, i).join("/"));
|
|
@@ -100,19 +121,19 @@ function getPackageData(module2) {
|
|
|
100
121
|
if (!packageDir)
|
|
101
122
|
throw new Error("no package dir");
|
|
102
123
|
const packageJson = JSON.parse((0, import_node_fs.readFileSync)(`${packageDir}/package.json`).toString());
|
|
103
|
-
return {
|
|
124
|
+
return { isDeepImport: !moduleSpecifier.endsWith(packageJson.name), modulePath };
|
|
104
125
|
} catch {
|
|
105
126
|
}
|
|
106
127
|
return null;
|
|
107
128
|
}
|
|
108
|
-
function isLocalFile(
|
|
109
|
-
return
|
|
129
|
+
function isLocalFile(moduleSpecifier) {
|
|
130
|
+
return moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/");
|
|
110
131
|
}
|
|
111
132
|
function isLocalDirectory(absoluteDirectory) {
|
|
112
133
|
return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
|
|
113
134
|
}
|
|
114
135
|
function evaluateTargetModule({
|
|
115
|
-
|
|
136
|
+
moduleSpecifier,
|
|
116
137
|
currentModuleExtension,
|
|
117
138
|
packageData,
|
|
118
139
|
isDirectory,
|
|
@@ -124,8 +145,8 @@ function evaluateTargetModule({
|
|
|
124
145
|
ensureFileExists
|
|
125
146
|
}) {
|
|
126
147
|
if (packageData)
|
|
127
|
-
return packageData.
|
|
128
|
-
module:
|
|
148
|
+
return packageData.modulePath.endsWith("index.js") && !moduleSpecifier.endsWith("index.js") && (moduleSpecifier = `${moduleSpecifier}/index`), {
|
|
149
|
+
module: moduleSpecifier + esExtensionDefault,
|
|
129
150
|
extension: esExtensionDefault
|
|
130
151
|
};
|
|
131
152
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
@@ -133,24 +154,27 @@ function evaluateTargetModule({
|
|
|
133
154
|
isDirectory && !(0, import_node_fs.existsSync)(
|
|
134
155
|
(0, import_node_path.resolve)(
|
|
135
156
|
filenameDirectory,
|
|
136
|
-
currentModuleExtension ?
|
|
157
|
+
currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
|
|
137
158
|
)
|
|
138
|
-
) && (
|
|
139
|
-
const targetFile = (0, import_node_path.resolve)(filenameDirectory,
|
|
159
|
+
) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
160
|
+
const targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
|
|
140
161
|
if (ensureFileExists) {
|
|
141
162
|
if (esExtensions.includes(filenameExtension) && (0, import_node_fs.existsSync)(targetFile + filenameExtension))
|
|
142
163
|
return {
|
|
143
|
-
module:
|
|
164
|
+
module: moduleSpecifier + (ensureFileExists.forceExtension || filenameExtension),
|
|
144
165
|
extension: filenameExtension
|
|
145
166
|
};
|
|
146
167
|
for (const extension of tryExtensions)
|
|
147
168
|
if ((0, import_node_fs.existsSync)(targetFile + extension))
|
|
148
|
-
return {
|
|
169
|
+
return {
|
|
170
|
+
module: moduleSpecifier + (ensureFileExists.forceExtension || extension),
|
|
171
|
+
extension
|
|
172
|
+
};
|
|
149
173
|
} else return esExtensions.includes(filenameExtension) ? {
|
|
150
|
-
module:
|
|
174
|
+
module: moduleSpecifier + filenameExtension,
|
|
151
175
|
extension: filenameExtension
|
|
152
176
|
} : {
|
|
153
|
-
module:
|
|
177
|
+
module: moduleSpecifier + esExtensionDefault,
|
|
154
178
|
extension: esExtensionDefault
|
|
155
179
|
};
|
|
156
180
|
return !1;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoD,oBACpD,mBAA0C
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoD,oBACpD,mBAA0C;AA8B1C,MAAM,kBAAkB;AAAA,EACtB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,eAAe,CAAC,OAAO,QAAQ,MAAM;AAAA,EACrC,cAAc,CAAC,OAAO,QAAQ,MAAM;AAAA,EACpC,iBAAiB,CAAC;AACpB;AAEe,SAAR,eACL,KACA,YACW;AACX,MAAI,cAAc,CAAC;AAEnB,QAAM,UAAU,EAAE,GAAG,iBAAiB,GAAG,WAAW,GAG9C,2BAA2B,CAC/B,MACA,UACG;AACH,UAAM,WAAW,MAAM,KAAK,KAAK;AACjC,QAAI,CAAC,SAAU;AAEf,UAAM,EAAE,KAAK,IAAI;AACjB,QAAI,KAAK,eAAe,OAAQ;AAEhC,UAAM,0BAA0B,KAAK,OAAO,OACtC,gCAAgC;AAAA,MACpC;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,IAAI,kCACF,KAAK,OAAO,QAAQ;AAAA,EAExB,GAGM,2BAA2B,CAC/B,MACA,UACG;AACH,UAAM,WAAW,MAAM,KAAK,KAAK;AACjC,QAAI,CAAC,SAAU;AAEf,UAAM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AI;AACF,WACE,YAAY,WAAW,SAAS,UAAU,KAC1C,CAAC,gBAAgB,SAAS,UAAU,MAEpC,kBAAkB,GAAG,eAAe,WAG/B;AAAA,MACL,QAAQ,kBAAkB;AAAA,MAC1B,WAAW;AAAA,IACb;AAGF,MAAI,0BAA0B,CAAC,aAAa,SAAS,sBAAsB;AACzE,WAAO;AAGT,EACE,eACA,KAAC;AAAA,QACC;AAAA,MACE;AAAA,MACA,yBAAyB,kBAAkB,kBAAkB;AAAA,IAC/D;AAAA,EACF,MAEA,kBAAkB,GAAG,eAAe;AAGtC,QAAM,iBAAa,0BAAQ,mBAAmB,eAAe;AAE7D,MAAI,kBAAkB;AAEpB,QACE,aAAa,SAAS,iBAAiB,SACvC,2BAAW,aAAa,iBAAiB;AAEzC,aAAO;AAAA,QACL,QAAQ,mBAAmB,iBAAiB,kBAAkB;AAAA,QAC9D,WAAW;AAAA,MACb;AAIF,eAAW,aAAa;AACtB,cAAI,2BAAW,aAAa,SAAS;AACnC,eAAO;AAAA,UACL,QAAQ,mBAAmB,iBAAiB,kBAAkB;AAAA,UAC9D;AAAA,QACF;AAAA,EAGN,MAAO,QAAI,aAAa,SAAS,iBAAiB,IACzC;AAAA,IACL,QAAQ,kBAAkB;AAAA,IAC1B,WAAW;AAAA,EACb,IAEO;AAAA,IACL,QAAQ,kBAAkB;AAAA,IAC1B,WAAW;AAAA,EACb;AAGF,SAAO;AACT;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -18,15 +18,7 @@ __export(src_exports, {
|
|
|
18
18
|
default: () => FullySpecified
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var import_node_fs = require("node:fs"), import_node_path = require("node:path")
|
|
22
|
-
function _array_like_to_array(arr, len) {
|
|
23
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
24
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
25
|
-
return arr2;
|
|
26
|
-
}
|
|
27
|
-
function _array_without_holes(arr) {
|
|
28
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
29
|
-
}
|
|
21
|
+
var import_node_fs = require("node:fs"), import_node_path = require("node:path");
|
|
30
22
|
function _define_property(obj, key, value) {
|
|
31
23
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
32
24
|
value,
|
|
@@ -35,129 +27,114 @@ function _define_property(obj, key, value) {
|
|
|
35
27
|
writable: !0
|
|
36
28
|
}) : obj[key] = value, obj;
|
|
37
29
|
}
|
|
38
|
-
function _iterable_to_array(iter) {
|
|
39
|
-
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
40
|
-
}
|
|
41
|
-
function _non_iterable_spread() {
|
|
42
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
|
-
}
|
|
44
30
|
function _object_spread(target) {
|
|
45
31
|
for (var i = 1; i < arguments.length; i++) {
|
|
46
|
-
var source = arguments[i] != null ? arguments[i] : {},
|
|
47
|
-
typeof Object.getOwnPropertySymbols == "function" && (
|
|
32
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys = Object.keys(source);
|
|
33
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
48
34
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
49
|
-
}))),
|
|
35
|
+
}))), ownKeys.forEach(function(key) {
|
|
50
36
|
_define_property(target, key, source[key]);
|
|
51
37
|
});
|
|
52
38
|
}
|
|
53
39
|
return target;
|
|
54
40
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
60
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
61
|
-
})), keys.push.apply(keys, symbols);
|
|
62
|
-
}
|
|
63
|
-
return keys;
|
|
64
|
-
}
|
|
65
|
-
function _object_spread_props(target, source) {
|
|
66
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
-
}), target;
|
|
69
|
-
}
|
|
70
|
-
function _to_consumable_array(arr) {
|
|
71
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
72
|
-
}
|
|
73
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
74
|
-
if (o) {
|
|
75
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
76
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
77
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
78
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
var makeDeclaration = function(param) {
|
|
82
|
-
var declaration = param.declaration, makeNodes = param.makeNodes, _param_ensureFileExists = param.ensureFileExists, ensureFileExists = _param_ensureFileExists === void 0 ? !1 : _param_ensureFileExists, _param_esExtensionDefault = param.esExtensionDefault, esExtensionDefault = _param_esExtensionDefault === void 0 ? ".js" : _param_esExtensionDefault, _param_tryExtensions = param.tryExtensions, tryExtensions = _param_tryExtensions === void 0 ? [
|
|
41
|
+
var DEFAULT_OPTIONS = {
|
|
42
|
+
ensureFileExists: !1,
|
|
43
|
+
esExtensionDefault: ".js",
|
|
44
|
+
tryExtensions: [
|
|
83
45
|
".js",
|
|
84
46
|
".mjs",
|
|
85
47
|
".cjs"
|
|
86
|
-
]
|
|
48
|
+
],
|
|
49
|
+
esExtensions: [
|
|
87
50
|
".js",
|
|
88
51
|
".mjs",
|
|
89
52
|
".cjs"
|
|
90
|
-
]
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
53
|
+
],
|
|
54
|
+
includePackages: []
|
|
55
|
+
};
|
|
56
|
+
function FullySpecified(api, rawOptions) {
|
|
57
|
+
api.assertVersion(7);
|
|
58
|
+
var options = _object_spread({}, DEFAULT_OPTIONS, rawOptions), importDeclarationVisitor = function(path, state) {
|
|
59
|
+
var filePath = state.file.opts.filename;
|
|
60
|
+
if (filePath) {
|
|
61
|
+
var node = path.node;
|
|
62
|
+
if (node.importKind !== "type") {
|
|
63
|
+
var originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
64
|
+
filePath,
|
|
65
|
+
options
|
|
66
|
+
});
|
|
67
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, exportDeclarationVisitor = function(path, state) {
|
|
71
|
+
var filePath = state.file.opts.filename;
|
|
72
|
+
if (filePath) {
|
|
73
|
+
var node = path.node;
|
|
74
|
+
if (node.exportKind !== "type") {
|
|
75
|
+
var source = node.source;
|
|
76
|
+
if (source) {
|
|
77
|
+
var originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
78
|
+
filePath,
|
|
79
|
+
options
|
|
80
|
+
});
|
|
81
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, importVisitor = function(path, state) {
|
|
86
|
+
var filePath = state.file.opts.filename;
|
|
87
|
+
if (filePath) {
|
|
88
|
+
var parent = path.parent;
|
|
89
|
+
if (parent.type === "CallExpression") {
|
|
90
|
+
var firstArgOfImportCall = parent.arguments[0];
|
|
91
|
+
if (firstArgOfImportCall.type === "StringLiteral") {
|
|
92
|
+
var originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
93
|
+
filePath,
|
|
94
|
+
options
|
|
111
95
|
});
|
|
112
|
-
|
|
113
|
-
var nodes = makeNodes(path);
|
|
114
|
-
path.replaceWith(
|
|
115
|
-
// @ts-ignore
|
|
116
|
-
declaration.apply(null, _to_consumable_array(nodes).concat([
|
|
117
|
-
(0, import_types.stringLiteral)(targetModule.module)
|
|
118
|
-
]))
|
|
119
|
-
);
|
|
120
|
-
}
|
|
96
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
121
97
|
}
|
|
122
98
|
}
|
|
123
99
|
}
|
|
124
100
|
};
|
|
125
|
-
|
|
126
|
-
function FullySpecified(api, options) {
|
|
127
|
-
return api.assertVersion(7), {
|
|
101
|
+
return {
|
|
128
102
|
name: "babel-plugin-fully-specified",
|
|
129
103
|
visitor: {
|
|
130
|
-
ImportDeclaration:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return [
|
|
135
|
-
specifiers
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
})),
|
|
139
|
-
ExportNamedDeclaration: makeDeclaration(_object_spread_props(_object_spread({}, options), {
|
|
140
|
-
declaration: import_types.exportNamedDeclaration,
|
|
141
|
-
makeNodes: function(param) {
|
|
142
|
-
var _param_node = param.node, declaration = _param_node.declaration, specifiers = _param_node.specifiers;
|
|
143
|
-
return [
|
|
144
|
-
declaration,
|
|
145
|
-
specifiers
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
})),
|
|
149
|
-
ExportAllDeclaration: makeDeclaration(_object_spread_props(_object_spread({}, options), {
|
|
150
|
-
declaration: import_types.exportAllDeclaration,
|
|
151
|
-
makeNodes: function() {
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
}))
|
|
104
|
+
ImportDeclaration: importDeclarationVisitor,
|
|
105
|
+
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
106
|
+
ExportAllDeclaration: exportDeclarationVisitor,
|
|
107
|
+
Import: importVisitor
|
|
155
108
|
}
|
|
156
109
|
};
|
|
157
110
|
}
|
|
158
|
-
function
|
|
111
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
112
|
+
var filePath = param.filePath, options = param.options, fileExt = (0, import_node_path.extname)(filePath), fileDir = (0, import_node_path.dirname)(filePath), includePackages = options.includePackages, packageData = null;
|
|
113
|
+
if (!isLocalFile(originalModuleSpecifier) && (includePackages.some(function(name) {
|
|
114
|
+
return originalModuleSpecifier.startsWith(name);
|
|
115
|
+
}) && (packageData = getPackageData(originalModuleSpecifier, filePath)), !(packageData && packageData.isDeepImport)))
|
|
116
|
+
return null;
|
|
117
|
+
var isDirectory = isLocalDirectory((0, import_node_path.resolve)(fileDir, originalModuleSpecifier)), currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier), tryExtensions = options.tryExtensions, esExtensions = options.esExtensions, esExtensionDefault = options.esExtensionDefault, ensureFileExists = options.ensureFileExists, targetModule = evaluateTargetModule({
|
|
118
|
+
moduleSpecifier: originalModuleSpecifier,
|
|
119
|
+
filenameDirectory: fileDir,
|
|
120
|
+
filenameExtension: fileExt,
|
|
121
|
+
packageData,
|
|
122
|
+
currentModuleExtension,
|
|
123
|
+
isDirectory,
|
|
124
|
+
tryExtensions,
|
|
125
|
+
esExtensions,
|
|
126
|
+
esExtensionDefault,
|
|
127
|
+
ensureFileExists
|
|
128
|
+
});
|
|
129
|
+
return targetModule === !1 || currentModuleExtension === targetModule.extension ? null : targetModule.module;
|
|
130
|
+
}
|
|
131
|
+
function getPackageData(moduleSpecifier, filePath) {
|
|
159
132
|
try {
|
|
160
|
-
for (var
|
|
133
|
+
for (var modulePath = require.resolve(moduleSpecifier, {
|
|
134
|
+
paths: filePath ? [
|
|
135
|
+
filePath
|
|
136
|
+
] : []
|
|
137
|
+
}), parts = modulePath.split("/"), packageDir = "", i = parts.length; i >= 0; i--) {
|
|
161
138
|
var dir = (0, import_node_path.dirname)(parts.slice(0, i).join("/"));
|
|
162
139
|
if ((0, import_node_fs.existsSync)("".concat(dir, "/package.json"))) {
|
|
163
140
|
packageDir = dir;
|
|
@@ -166,36 +143,36 @@ function getPackageData(module2) {
|
|
|
166
143
|
}
|
|
167
144
|
if (!packageDir)
|
|
168
145
|
throw new Error("no package dir");
|
|
169
|
-
var packageJson = JSON.parse((0, import_node_fs.readFileSync)("".concat(packageDir, "/package.json")).toString()),
|
|
146
|
+
var packageJson = JSON.parse((0, import_node_fs.readFileSync)("".concat(packageDir, "/package.json")).toString()), isDeepImport = !moduleSpecifier.endsWith(packageJson.name);
|
|
170
147
|
return {
|
|
171
|
-
|
|
172
|
-
|
|
148
|
+
isDeepImport,
|
|
149
|
+
modulePath
|
|
173
150
|
};
|
|
174
151
|
} catch {
|
|
175
152
|
}
|
|
176
153
|
return null;
|
|
177
154
|
}
|
|
178
|
-
function isLocalFile(
|
|
179
|
-
return
|
|
155
|
+
function isLocalFile(moduleSpecifier) {
|
|
156
|
+
return moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/");
|
|
180
157
|
}
|
|
181
158
|
function isLocalDirectory(absoluteDirectory) {
|
|
182
159
|
return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
|
|
183
160
|
}
|
|
184
161
|
function evaluateTargetModule(param) {
|
|
185
|
-
var
|
|
162
|
+
var moduleSpecifier = param.moduleSpecifier, currentModuleExtension = param.currentModuleExtension, packageData = param.packageData, isDirectory = param.isDirectory, filenameDirectory = param.filenameDirectory, filenameExtension = param.filenameExtension, tryExtensions = param.tryExtensions, esExtensions = param.esExtensions, esExtensionDefault = param.esExtensionDefault, ensureFileExists = param.ensureFileExists;
|
|
186
163
|
if (packageData)
|
|
187
|
-
return packageData.
|
|
188
|
-
module:
|
|
164
|
+
return packageData.modulePath.endsWith("index.js") && !moduleSpecifier.endsWith("index.js") && (moduleSpecifier = "".concat(moduleSpecifier, "/index")), {
|
|
165
|
+
module: moduleSpecifier + esExtensionDefault,
|
|
189
166
|
extension: esExtensionDefault
|
|
190
167
|
};
|
|
191
168
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
192
169
|
return !1;
|
|
193
|
-
isDirectory && !(0, import_node_fs.existsSync)((0, import_node_path.resolve)(filenameDirectory, currentModuleExtension ?
|
|
194
|
-
var targetFile = (0, import_node_path.resolve)(filenameDirectory,
|
|
170
|
+
isDirectory && !(0, import_node_fs.existsSync)((0, import_node_path.resolve)(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = "".concat(moduleSpecifier, "/index"));
|
|
171
|
+
var targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
|
|
195
172
|
if (ensureFileExists) {
|
|
196
173
|
if (esExtensions.includes(filenameExtension) && (0, import_node_fs.existsSync)(targetFile + filenameExtension))
|
|
197
174
|
return {
|
|
198
|
-
module:
|
|
175
|
+
module: moduleSpecifier + (ensureFileExists.forceExtension || filenameExtension),
|
|
199
176
|
extension: filenameExtension
|
|
200
177
|
};
|
|
201
178
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
@@ -204,7 +181,7 @@ function evaluateTargetModule(param) {
|
|
|
204
181
|
var extension = _step.value;
|
|
205
182
|
if ((0, import_node_fs.existsSync)(targetFile + extension))
|
|
206
183
|
return {
|
|
207
|
-
module:
|
|
184
|
+
module: moduleSpecifier + (ensureFileExists.forceExtension || extension),
|
|
208
185
|
extension
|
|
209
186
|
};
|
|
210
187
|
}
|
|
@@ -219,10 +196,10 @@ function evaluateTargetModule(param) {
|
|
|
219
196
|
}
|
|
220
197
|
}
|
|
221
198
|
} else return esExtensions.includes(filenameExtension) ? {
|
|
222
|
-
module:
|
|
199
|
+
module: moduleSpecifier + filenameExtension,
|
|
223
200
|
extension: filenameExtension
|
|
224
201
|
} : {
|
|
225
|
-
module:
|
|
202
|
+
module: moduleSpecifier + esExtensionDefault,
|
|
226
203
|
extension: esExtensionDefault
|
|
227
204
|
};
|
|
228
205
|
return !1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/packages/babel-plugin-fully-specified/src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,qBAAoD,oBACpD,mBAA0C,
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,qBAAoD,oBACpD,mBAA0C;;;;;;;;;;;;;;;;;;;;AA8B1C,IAAMA,kBAAkB;EACtBC,kBAAkB;EAClBC,oBAAoB;EACpBC,eAAe;IAAC;IAAO;IAAQ;;EAC/BC,cAAc;IAAC;IAAO;IAAQ;;EAC9BC,iBAAiB,CAAA;AACnB;AAEe,SAAf,eACEC,KACAC,YAAiC;AAEjCD,MAAIE,cAAc,CAAA;AAElB,MAAMC,UAAU,eAAA,CAAA,GAAKT,iBAAoBO,UAAAA,GAGnCG,2BAA2B,SAC/BC,MACAC,OAAAA;AAEA,QAAMC,WAAWD,MAAME,KAAKC,KAAKC;AACjC,QAAKH,UAEL;UAAQI,OAASN,KAATM;AACR,UAAIA,KAAKC,eAAe,QAExB;YAAMC,0BAA0BF,KAAKG,OAAOC,OACtCC,gCAAgCC,iCACpCJ,yBACA;UACEN;U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BAAiBgF,kBAAkBzB;YAC9DA;UACF;MAEJ;;AAPK,0BAAA,IAAA,iBAAA;;;SAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;YAAA;gBAAA;;;EAQP,MAAO,QAAIpD,aAAa2E,SAASxB,iBAAAA,IACxB;IACLE,QAAQJ,kBAAkBE;IAC1BC,WAAWD;EACb,IAEO;IACLE,QAAQJ,kBAAkBnD;IAC1BsD,WAAWtD;EACb;AAGF,SAAO;AACT;",
|
|
5
|
+
"names": ["DEFAULT_OPTIONS", "ensureFileExists", "esExtensionDefault", "tryExtensions", "esExtensions", "includePackages", "api", "rawOptions", "assertVersion", "options", "importDeclarationVisitor", "path", "state", "filePath", "file", "opts", "filename", "node", "importKind", "originalModuleSpecifier", "source", "value", "fullySpecifiedModuleSpecifier", "getFullySpecifiedModuleSpecifier", "exportDeclarationVisitor", "exportKind", "importVisitor", "parent", "type", "firstArgOfImportCall", "arguments", "name", "visitor", "ImportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "Import", "fileExt", "extname", "fileDir", "dirname", "packageData", "isLocalFile", "some", "startsWith", "getPackageData", "isDeepImport", "isDirectory", "isLocalDirectory", "resolve", "currentModuleExtension", "targetModule", "evaluateTargetModule", "moduleSpecifier", "filenameDirectory", "filenameExtension", "extension", "module", "modulePath", "require", "paths", "parts", "split", "packageDir", "i", "length", "dir", "slice", "join", "existsSync", "Error", "packageJson", "JSON", "parse", "readFileSync", "toString", "endsWith", "absoluteDirectory", "lstatSync", "includes", "targetFile", "forceExtension"]
|
|
6
6
|
}
|