@tamagui/babel-plugin-fully-specified 1.111.3 → 1.111.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/dist/cjs/index.js +75 -74
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +74 -73
- package/dist/esm/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -17,43 +18,63 @@ __export(src_exports, {
|
|
|
17
18
|
default: () => FullySpecified
|
|
18
19
|
});
|
|
19
20
|
module.exports = __toCommonJS(src_exports);
|
|
20
|
-
var import_node_fs = require("node:fs"), import_node_path = require("node:path")
|
|
21
|
-
const DEFAULT_OPTIONS = {
|
|
21
|
+
var import_node_fs = require("node:fs"), import_node_path = require("node:path"), DEFAULT_OPTIONS = {
|
|
22
22
|
ensureFileExists: !0,
|
|
23
23
|
esExtensionDefault: ".mjs",
|
|
24
|
-
tryExtensions: [
|
|
25
|
-
|
|
24
|
+
tryExtensions: [
|
|
25
|
+
".js"
|
|
26
|
+
],
|
|
27
|
+
esExtensions: [
|
|
28
|
+
".mjs"
|
|
29
|
+
]
|
|
26
30
|
};
|
|
27
31
|
function FullySpecified(api, rawOptions) {
|
|
28
32
|
api.assertVersion(7);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
var options = {
|
|
34
|
+
...DEFAULT_OPTIONS,
|
|
35
|
+
...rawOptions
|
|
36
|
+
}, importDeclarationVisitor = function(path, state) {
|
|
37
|
+
var filePath = state.file.opts.filename;
|
|
38
|
+
if (filePath) {
|
|
39
|
+
var { node } = path;
|
|
40
|
+
if (node.importKind !== "type") {
|
|
41
|
+
var originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
42
|
+
filePath,
|
|
43
|
+
options
|
|
44
|
+
});
|
|
45
|
+
fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
}
|
|
48
|
+
}, exportDeclarationVisitor = function(path, state) {
|
|
49
|
+
var filePath = state.file.opts.filename;
|
|
50
|
+
if (filePath) {
|
|
51
|
+
var { node } = path;
|
|
52
|
+
if (node.exportKind !== "type") {
|
|
53
|
+
var source = node.source;
|
|
54
|
+
if (source) {
|
|
55
|
+
var originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
56
|
+
filePath,
|
|
57
|
+
options
|
|
58
|
+
});
|
|
59
|
+
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, importVisitor = function(path, state) {
|
|
64
|
+
var filePath = state.file.opts.filename;
|
|
65
|
+
if (filePath) {
|
|
66
|
+
var parent = path.parent;
|
|
67
|
+
if (parent.type === "CallExpression") {
|
|
68
|
+
var firstArgOfImportCall = parent.arguments[0];
|
|
69
|
+
if (firstArgOfImportCall.type === "StringLiteral") {
|
|
70
|
+
var originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
71
|
+
filePath,
|
|
72
|
+
options
|
|
73
|
+
});
|
|
74
|
+
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
75
|
+
}
|
|
54
76
|
}
|
|
55
|
-
|
|
56
|
-
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
77
|
+
}
|
|
57
78
|
};
|
|
58
79
|
return {
|
|
59
80
|
name: "babel-plugin-fully-specified",
|
|
@@ -61,32 +82,12 @@ function FullySpecified(api, rawOptions) {
|
|
|
61
82
|
ImportDeclaration: importDeclarationVisitor,
|
|
62
83
|
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
63
84
|
ExportAllDeclaration: exportDeclarationVisitor,
|
|
64
|
-
Import:
|
|
65
|
-
const filePath = state.file.opts.filename;
|
|
66
|
-
if (!filePath) return;
|
|
67
|
-
const parent = path.parent;
|
|
68
|
-
if (parent.type !== "CallExpression")
|
|
69
|
-
return;
|
|
70
|
-
const firstArgOfImportCall = parent.arguments[0];
|
|
71
|
-
if (firstArgOfImportCall.type !== "StringLiteral")
|
|
72
|
-
return;
|
|
73
|
-
const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
74
|
-
originalModuleSpecifier,
|
|
75
|
-
{
|
|
76
|
-
filePath,
|
|
77
|
-
options
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
81
|
-
}
|
|
85
|
+
Import: importVisitor
|
|
82
86
|
}
|
|
83
87
|
};
|
|
84
88
|
}
|
|
85
|
-
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
86
|
-
filePath,
|
|
87
|
-
options
|
|
88
|
-
}) {
|
|
89
|
-
const fileExt = (0, import_node_path.extname)(filePath), fileDir = (0, import_node_path.dirname)(filePath), isDirectory = isLocalDirectory((0, import_node_path.resolve)(fileDir, originalModuleSpecifier)), currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
89
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
90
|
+
var { filePath, options } = param, fileExt = (0, import_node_path.extname)(filePath), fileDir = (0, import_node_path.dirname)(filePath), isDirectory = isLocalDirectory((0, import_node_path.resolve)(fileDir, originalModuleSpecifier)), currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
90
91
|
moduleSpecifier: originalModuleSpecifier,
|
|
91
92
|
filenameDirectory: fileDir,
|
|
92
93
|
filenameExtension: fileExt,
|
|
@@ -102,30 +103,30 @@ function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
|
102
103
|
function isLocalDirectory(absoluteDirectory) {
|
|
103
104
|
return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
|
|
104
105
|
}
|
|
105
|
-
function evaluateTargetModule({
|
|
106
|
-
moduleSpecifier,
|
|
107
|
-
currentModuleExtension,
|
|
108
|
-
isDirectory,
|
|
109
|
-
filenameDirectory,
|
|
110
|
-
filenameExtension,
|
|
111
|
-
tryExtensions,
|
|
112
|
-
esExtensions,
|
|
113
|
-
esExtensionDefault,
|
|
114
|
-
ensureFileExists
|
|
115
|
-
}) {
|
|
106
|
+
function evaluateTargetModule(param) {
|
|
107
|
+
var { moduleSpecifier, currentModuleExtension, isDirectory, filenameDirectory, filenameExtension, tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = param;
|
|
116
108
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
117
109
|
return !1;
|
|
118
|
-
isDirectory && !(0, import_node_fs.existsSync)(
|
|
119
|
-
|
|
120
|
-
filenameDirectory,
|
|
121
|
-
currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
|
|
122
|
-
)
|
|
123
|
-
) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
124
|
-
const targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
|
|
110
|
+
isDirectory && !(0, import_node_fs.existsSync)((0, import_node_path.resolve)(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
111
|
+
var targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
|
|
125
112
|
if (ensureFileExists) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
114
|
+
try {
|
|
115
|
+
for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
116
|
+
var extension = _step.value;
|
|
117
|
+
if ((0, import_node_fs.existsSync)(targetFile + extension))
|
|
118
|
+
return moduleSpecifier + esExtensionDefault;
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
122
|
+
} finally {
|
|
123
|
+
try {
|
|
124
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
125
|
+
} finally {
|
|
126
|
+
if (_didIteratorError)
|
|
127
|
+
throw _iteratorError;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
129
130
|
} else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
|
|
130
131
|
return !1;
|
|
131
132
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/packages/bab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AA,GAAA,OAAA,4BAAA,IAAkC;AAAlC,YAAMmD,YAAN,MAAA;AACH,gBAAIJ,2BAAWG,aAAaC,SAAAA;AAC1B,iBAAOR,kBAAkB5C;MAE7B;;AAJK,0BAAA,IAAA,iBAAA;;;SAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;YAAA;gBAAA;;;EAKP,MAAO,QAAIE,aAAagD,SAASJ,iBAAAA,GACxBF,kBAAkB5C;AAK3B,SAAO;AACT;",
|
|
5
|
+
"names": ["DEFAULT_OPTIONS", "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", "extname", "fileDir", "dirname", "isDirectory", "isLocalDirectory", "resolve", "currentModuleExtension", "targetModule", "evaluateTargetModule", "moduleSpecifier", "filenameDirectory", "filenameExtension", "absoluteDirectory", "existsSync", "lstatSync", "includes", "targetFile", "extension"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,41 +1,62 @@
|
|
|
1
1
|
import { existsSync, lstatSync } from "node:fs";
|
|
2
2
|
import { resolve, extname, dirname } 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
var options = {
|
|
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);
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
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);
|
|
57
|
+
}
|
|
36
58
|
}
|
|
37
|
-
|
|
38
|
-
fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
|
|
59
|
+
}
|
|
39
60
|
};
|
|
40
61
|
return {
|
|
41
62
|
name: "babel-plugin-fully-specified",
|
|
@@ -43,32 +64,12 @@ function FullySpecified(api, rawOptions) {
|
|
|
43
64
|
ImportDeclaration: importDeclarationVisitor,
|
|
44
65
|
ExportNamedDeclaration: exportDeclarationVisitor,
|
|
45
66
|
ExportAllDeclaration: exportDeclarationVisitor,
|
|
46
|
-
Import:
|
|
47
|
-
const filePath = state.file.opts.filename;
|
|
48
|
-
if (!filePath) return;
|
|
49
|
-
const parent = path.parent;
|
|
50
|
-
if (parent.type !== "CallExpression")
|
|
51
|
-
return;
|
|
52
|
-
const firstArgOfImportCall = parent.arguments[0];
|
|
53
|
-
if (firstArgOfImportCall.type !== "StringLiteral")
|
|
54
|
-
return;
|
|
55
|
-
const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
|
|
56
|
-
originalModuleSpecifier,
|
|
57
|
-
{
|
|
58
|
-
filePath,
|
|
59
|
-
options
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
|
|
63
|
-
}
|
|
67
|
+
Import: importVisitor
|
|
64
68
|
}
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
|
-
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
68
|
-
filePath,
|
|
69
|
-
options
|
|
70
|
-
}) {
|
|
71
|
-
const fileExt = extname(filePath), fileDir = dirname(filePath), isDirectory = isLocalDirectory(resolve(fileDir, originalModuleSpecifier)), currentModuleExtension = extname(originalModuleSpecifier), { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options, targetModule = evaluateTargetModule({
|
|
71
|
+
function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
|
|
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({
|
|
72
73
|
moduleSpecifier: originalModuleSpecifier,
|
|
73
74
|
filenameDirectory: fileDir,
|
|
74
75
|
filenameExtension: fileExt,
|
|
@@ -84,30 +85,30 @@ function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
|
|
|
84
85
|
function isLocalDirectory(absoluteDirectory) {
|
|
85
86
|
return existsSync(absoluteDirectory) && lstatSync(absoluteDirectory).isDirectory();
|
|
86
87
|
}
|
|
87
|
-
function evaluateTargetModule({
|
|
88
|
-
moduleSpecifier,
|
|
89
|
-
currentModuleExtension,
|
|
90
|
-
isDirectory,
|
|
91
|
-
filenameDirectory,
|
|
92
|
-
filenameExtension,
|
|
93
|
-
tryExtensions,
|
|
94
|
-
esExtensions,
|
|
95
|
-
esExtensionDefault,
|
|
96
|
-
ensureFileExists
|
|
97
|
-
}) {
|
|
88
|
+
function evaluateTargetModule(param) {
|
|
89
|
+
var { moduleSpecifier, currentModuleExtension, isDirectory, filenameDirectory, filenameExtension, tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = param;
|
|
98
90
|
if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
|
|
99
91
|
return !1;
|
|
100
|
-
isDirectory && !existsSync(
|
|
101
|
-
|
|
102
|
-
filenameDirectory,
|
|
103
|
-
currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
|
|
104
|
-
)
|
|
105
|
-
) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
106
|
-
const targetFile = resolve(filenameDirectory, moduleSpecifier);
|
|
92
|
+
isDirectory && !existsSync(resolve(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
|
|
93
|
+
var targetFile = resolve(filenameDirectory, moduleSpecifier);
|
|
107
94
|
if (ensureFileExists) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
96
|
+
try {
|
|
97
|
+
for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
98
|
+
var extension = _step.value;
|
|
99
|
+
if (existsSync(targetFile + extension))
|
|
100
|
+
return moduleSpecifier + esExtensionDefault;
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
104
|
+
} finally {
|
|
105
|
+
try {
|
|
106
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
107
|
+
} finally {
|
|
108
|
+
if (_didIteratorError)
|
|
109
|
+
throw _iteratorError;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
111
112
|
} else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
|
|
112
113
|
return !1;
|
|
113
114
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/packages/babel-plugin-fully-specified/src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,SAASA,YAA0BC,iBAAiB;AACpD,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,MAAME,KAAKC,KAAKC;AACjC,QAAKH,UAEL;UAAM,EAAEI,KAAI,IAAKN;AACjB,UAAIM,KAAKC,eAAe,QAExB;YAAMC,0BAA0BF,KAAKG,OAAOC,OACtCC,gCAAgCC,iCACpCJ,yBACA;UACEN;UACAJ;QACF,CAAA;AAGF,QAAIa,kCACFL,KAAKG,OAAOC,QAAQC;;;EAExB,GAGME,2BAA2B,SAC/Bb,MACAC,OAAAA;AAEA,QAAMC,WAAWD,MAAME,KAAKC,KAAKC;AACjC,QAAKH,UAEL;UAAM,EAAEI,KAAI,IAAKN;AACjB,UAAIM,KAAKQ,eAAe,QAExB;YAAML,SAASH,KAAKG;AACpB,YAAKA,QAEL;cAAMD,0BAA0BC,OAAOC,OACjCC,gCAAgCC,iCACpCJ,yBACA;YACEN;YACAJ;UACF,CAAA;AAGF,UAAIa,kCACFF,OAAOC,QAAQC;;;;EAEnB,GAGMI,gBAAgB,SAACf,MAAwBC,OAAAA;AAC7C,QAAMC,WAAWD,MAAME,KAAKC,KAAKC;AACjC,QAAKH,UAEL;UAAMc,SAAShB,KAAKgB;AACpB,UAAIA,OAAOC,SAAS,kBAIpB;YAAMC,uBAAuBF,OAAOG,UAAU,C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,IAAA,oBAAA,IAAA,iBAAA;;AAAL,eAAK,YAAmBE,cAAAA,OAAAA,QAAAA,EAAAA,GAAnB,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,GAAA,OAAA,4BAAA,IAAkC;AAAlC,YAAM8C,YAAN,MAAA;AACH,YAAItD,WAAWqD,aAAaC,SAAAA;AAC1B,iBAAON,kBAAkBzC;MAE7B;;AAJK,0BAAA,IAAA,iBAAA;;;SAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;YAAA;gBAAA;;;EAKP,MAAO,QAAIE,aAAa2C,SAASF,iBAAAA,GACxBF,kBAAkBzC;AAK3B,SAAO;AACT;",
|
|
5
|
+
"names": ["existsSync", "lstatSync", "resolve", "extname", "dirname", "DEFAULT_OPTIONS", "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
6
|
}
|