@tamagui/babel-plugin-fully-specified 1.113.0 → 1.113.2
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.
|
@@ -15,11 +15,9 @@ function fullySpecifyCommonJS(api) {
|
|
|
15
15
|
if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
|
|
16
16
|
var filePath = state.file.opts.filename;
|
|
17
17
|
if (!filePath) return;
|
|
18
|
-
var fileDir = dirname(filePath),
|
|
19
|
-
cjsExtension = ".cjs";
|
|
18
|
+
var fileDir = dirname(filePath), cjsExtension = ".cjs";
|
|
20
19
|
if (!extname(moduleSpecifier)) {
|
|
21
|
-
var resolvedPath = resolve(fileDir, moduleSpecifier),
|
|
22
|
-
newModuleSpecifier = moduleSpecifier;
|
|
20
|
+
var resolvedPath = resolve(fileDir, moduleSpecifier), newModuleSpecifier = moduleSpecifier;
|
|
23
21
|
if (isLocalDirectory(resolvedPath)) {
|
|
24
22
|
var indexPath = resolve(resolvedPath, "index" + cjsExtension);
|
|
25
23
|
if (existsSync(indexPath)) {
|
|
@@ -43,5 +41,7 @@ function fullySpecifyCommonJS(api) {
|
|
|
43
41
|
function isLocalDirectory(absolutePath) {
|
|
44
42
|
return existsSync(absolutePath) && lstatSync(absolutePath).isDirectory();
|
|
45
43
|
}
|
|
46
|
-
export {
|
|
47
|
-
|
|
44
|
+
export {
|
|
45
|
+
fullySpecifyCommonJS as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=commonjs.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/packages/babel-plugin-fully-specified/src/commonjs.ts"],
|
|
4
|
+
"mappings": "AAAA,SAASA,YAAYC,iBAAiB;AACtC,SAASC,SAASC,SAASC,eAAe;AAE3B,SAAf,qBAA6CC,KAAG;AAC9CA,aAAIC,cAAc,CAAA,GAEX;IACLC,MAAM;IACNC,SAAS;MACPC,eAAeC,MAAMC,OAAK;AACxB,YAAMC,SAASF,KAAKG,IAAI,QAAA;AAExB,YACED,OAAOE,aAAa;UAAEP,MAAM;QAAU,CAAA,KACtCG,KAAKK,KAAKC,UAAUC,WAAW,GAC/B;AACA,cAAMC,MAAMR,KAAKK,KAAKC,UAAU,CAAA;AAChC,cAAIE,IAAIC,SAAS,iBAAiB;AAChC,gBAAIC,kBAAkBF,IAAIG;AAG1B,gBAAID,gBAAgBE,WAAW,GAAA,KAAQF,gBAAgBE,WAAW,GAAA,GAAM;AACtE,kBAAMC,WAAWZ,MAAMa,KAAKC,KAAKC;AACjC,kBAAI,CAACH,SAAU;AAEf,kBAAMI,UAAUzB,QAAQqB,QAAAA,GAClBK,eAAe;AAGrB,kBAAI,CAACzB,QAAQiB,eAAAA,GAAkB;AAC7B,oBAAMS,eAAezB,QAAQuB,SAASP,eAAAA,GAClCU,qBAAqBV;AAGzB,oBAAIW,iBAAiBF,YAAAA,GAAe;AAClC,sBAAMG,YAAY5B,QAAQyB,cAAc,UAAUD,YAAAA;AAClD,sBAAI5B,WAAWgC,SAAAA,GAAY;AAEzB,oBAAKF,mBAAmBG,SAAS,GAAA,MAC/BH,sBAAsB,MAExBA,sBAAsB,UAAUF,cAChCV,IAAIG,QAAQS;AACZ;kBACF;gBACF;AAGA,oBAAMI,kBAAkBL,eAAeD;AACvC,oBAAI5B,WAAWkC,eAAAA,GAAkB;AAC/BJ,wCAAsBF,cACtBV,IAAIG,QAAQS;AACZ;gBACF;cACF;YACF;UACF;QACF;MACF;IACF;EACF;AACF;AAEA,SAASC,iBAAiBI,cAAY;AACpC,SAAOnC,WAAWmC,YAAAA,KAAiBlC,UAAUkC,YAAAA,EAAcC,YAAW;AACxE;",
|
|
5
|
+
"names": ["existsSync", "lstatSync", "dirname", "extname", "resolve", "api", "assertVersion", "name", "visitor", "CallExpression", "path", "state", "callee", "get", "isIdentifier", "node", "arguments", "length", "arg", "type", "moduleSpecifier", "value", "startsWith", "filePath", "file", "opts", "filename", "fileDir", "cjsExtension", "resolvedPath", "newModuleSpecifier", "isLocalDirectory", "indexPath", "endsWith", "filePathWithCjs", "absolutePath", "isDirectory"]
|
|
6
|
+
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -3,67 +3,61 @@ import { dirname, extname, resolve } from "node:path";
|
|
|
3
3
|
var DEFAULT_OPTIONS = {
|
|
4
4
|
ensureFileExists: !0,
|
|
5
5
|
esExtensionDefault: ".mjs",
|
|
6
|
-
tryExtensions: [
|
|
7
|
-
|
|
6
|
+
tryExtensions: [
|
|
7
|
+
".js"
|
|
8
|
+
],
|
|
9
|
+
esExtensions: [
|
|
10
|
+
".mjs"
|
|
11
|
+
]
|
|
8
12
|
};
|
|
9
13
|
function FullySpecified(api, rawOptions) {
|
|
10
14
|
api.assertVersion(7);
|
|
11
15
|
var options = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
filePath,
|
|
25
|
-
options
|
|
26
|
-
});
|
|
27
|
-
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
28
|
-
}
|
|
16
|
+
...DEFAULT_OPTIONS,
|
|
17
|
+
...rawOptions
|
|
18
|
+
}, importDeclarationVisitor = function(path, state) {
|
|
19
|
+
var filePath = state.file.opts.filename;
|
|
20
|
+
if (filePath) {
|
|
21
|
+
var { node } = path;
|
|
22
|
+
if (node.importKind !== "type") {
|
|
23
|
+
var originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
24
|
+
filePath,
|
|
25
|
+
options
|
|
26
|
+
});
|
|
27
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
29
28
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
var source =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
options
|
|
44
|
-
});
|
|
45
|
-
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
46
|
-
}
|
|
29
|
+
}
|
|
30
|
+
}, exportDeclarationVisitor = function(path, state) {
|
|
31
|
+
var filePath = state.file.opts.filename;
|
|
32
|
+
if (filePath) {
|
|
33
|
+
var { node } = path;
|
|
34
|
+
if (node.exportKind !== "type") {
|
|
35
|
+
var source = node.source;
|
|
36
|
+
if (source) {
|
|
37
|
+
var originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
38
|
+
filePath,
|
|
39
|
+
options
|
|
40
|
+
});
|
|
41
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
63
|
-
}
|
|
44
|
+
}
|
|
45
|
+
}, importVisitor = function(path, state) {
|
|
46
|
+
var filePath = state.file.opts.filename;
|
|
47
|
+
if (filePath) {
|
|
48
|
+
var parent = path.parent;
|
|
49
|
+
if (parent.type === "CallExpression") {
|
|
50
|
+
var firstArgOfImportCall = parent.arguments[0];
|
|
51
|
+
if (firstArgOfImportCall.type === "StringLiteral") {
|
|
52
|
+
var originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
53
|
+
filePath,
|
|
54
|
+
options
|
|
55
|
+
});
|
|
56
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
|
-
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
67
61
|
return {
|
|
68
62
|
name: "babel-plugin-fully-specified",
|
|
69
63
|
visitor: {
|
|
@@ -75,58 +69,34 @@ function FullySpecified(api, rawOptions) {
|
|
|
75
69
|
};
|
|
76
70
|
}
|
|
77
71
|
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
78
|
-
var {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
fileExt = extname(filePath),
|
|
83
|
-
fileDir = dirname(filePath),
|
|
84
|
-
isDirectory = isLocalDirectory(resolve(fileDir, originalModuleSpecifier)),
|
|
85
|
-
currentModuleExtension = extname(originalModuleSpecifier),
|
|
86
|
-
{
|
|
87
|
-
tryExtensions,
|
|
88
|
-
esExtensions,
|
|
89
|
-
esExtensionDefault,
|
|
90
|
-
ensureFileExists
|
|
91
|
-
} = options,
|
|
92
|
-
targetModule = evaluateTargetModule({
|
|
93
|
-
moduleSpecifier: originalModuleSpecifier,
|
|
94
|
-
filenameDirectory: fileDir,
|
|
95
|
-
filenameExtension: fileExt,
|
|
96
|
-
currentModuleExtension,
|
|
97
|
-
isDirectory,
|
|
98
|
-
tryExtensions,
|
|
99
|
-
esExtensions,
|
|
100
|
-
esExtensionDefault,
|
|
101
|
-
ensureFileExists
|
|
102
|
-
});
|
|
103
|
-
return targetModule === !1 ? null : targetModule;
|
|
104
|
-
}
|
|
105
|
-
function isLocalDirectory(absoluteDirectory) {
|
|
106
|
-
return existsSync(absoluteDirectory) && lstatSync(absoluteDirectory).isDirectory();
|
|
107
|
-
}
|
|
108
|
-
function evaluateTargetModule(param) {
|
|
109
|
-
var {
|
|
110
|
-
moduleSpecifier,
|
|
72
|
+
var { filePath, options } = param, fileExt = extname(filePath), fileDir = dirname(filePath), isDirectory = isLocalDirectory(resolve(fileDir, originalModuleSpecifier)), currentModuleExtension = extname(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
73
|
+
moduleSpecifier: originalModuleSpecifier,
|
|
74
|
+
filenameDirectory: fileDir,
|
|
75
|
+
filenameExtension: fileExt,
|
|
111
76
|
currentModuleExtension,
|
|
112
77
|
isDirectory,
|
|
113
|
-
filenameDirectory,
|
|
114
|
-
filenameExtension,
|
|
115
78
|
tryExtensions,
|
|
116
79
|
esExtensions,
|
|
117
80
|
esExtensionDefault,
|
|
118
81
|
ensureFileExists
|
|
119
|
-
}
|
|
120
|
-
|
|
82
|
+
});
|
|
83
|
+
return targetModule === !1 ? null : targetModule;
|
|
84
|
+
}
|
|
85
|
+
function isLocalDirectory(absoluteDirectory) {
|
|
86
|
+
return existsSync(absoluteDirectory) && lstatSync(absoluteDirectory).isDirectory();
|
|
87
|
+
}
|
|
88
|
+
function evaluateTargetModule(param) {
|
|
89
|
+
var { moduleSpecifier, currentModuleExtension, isDirectory, filenameDirectory, filenameExtension, tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = param;
|
|
90
|
+
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
91
|
+
return !1;
|
|
121
92
|
var targetFile = resolve(filenameDirectory, moduleSpecifier);
|
|
122
93
|
if (ensureFileExists) {
|
|
123
|
-
var _iteratorNormalCompletion = !0,
|
|
124
|
-
_didIteratorError = !1,
|
|
125
|
-
_iteratorError = void 0;
|
|
94
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
126
95
|
try {
|
|
127
96
|
for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
128
97
|
var extension = _step.value;
|
|
129
|
-
if (existsSync(targetFile + extension))
|
|
98
|
+
if (existsSync(targetFile + extension))
|
|
99
|
+
return moduleSpecifier + esExtensionDefault;
|
|
130
100
|
}
|
|
131
101
|
} catch (err) {
|
|
132
102
|
_didIteratorError = !0, _iteratorError = err;
|
|
@@ -134,12 +104,15 @@ function evaluateTargetModule(param) {
|
|
|
134
104
|
try {
|
|
135
105
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
136
106
|
} finally {
|
|
137
|
-
if (_didIteratorError)
|
|
107
|
+
if (_didIteratorError)
|
|
108
|
+
throw _iteratorError;
|
|
138
109
|
}
|
|
139
110
|
}
|
|
140
111
|
isDirectory && !existsSync(resolve(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
141
112
|
} else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
|
|
142
113
|
return !1;
|
|
143
114
|
}
|
|
144
|
-
export {
|
|
145
|
-
|
|
115
|
+
export {
|
|
116
|
+
FullySpecified as default
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/packages/babel-plugin-fully-specified/src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,SAASA,YAAYC,iBAAiB;AACtC,SAASC,SAASC,SAASC,eAAe;AAmB1C,IAAMC,kBAAkB;EACtBC,kBAAkB;EAClBC,oBAAoB;EACpBC,eAAe;IAAC;;EAChBC,cAAc;IAAC;;AACjB;AAEe,SAAf,eACEC,KACAC,YAAiC;AAEjCD,MAAIE,cAAc,CAAA;AAElB,MAAMC,UAAU;IAAE,GAAGR;IAAiB,GAAGM;EAAW,GAG9CG,2BAA2B,SAC/BC,MACAC,OAAAA;AAEA,QAAMC,WAAWD,MAA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ensureFileExists", "esExtensionDefault", "tryExtensions", "esExtensions", "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", "fileDir", "isDirectory", "isLocalDirectory", "currentModuleExtension", "targetModule", "evaluateTargetModule", "moduleSpecifier", "filenameDirectory", "filenameExtension", "absoluteDirectory", "includes", "targetFile", "extension"]
|
|
6
|
+
}
|