@tamagui/babel-plugin-fully-specified 1.129.14 → 1.129.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/babel-plugin-fully-specified",
3
- "version": "1.129.14",
3
+ "version": "1.129.15",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs/index.js",
@@ -15,8 +15,8 @@
15
15
  "access": "public"
16
16
  },
17
17
  "scripts": {
18
- "build": "node ../../../node_modules/.bin/tamagui-build --exclude __tests__",
19
- "watch": "node ../../../node_modules/.bin/tamagui-build --exclude __tests__ --watch",
18
+ "build": "node ../../../node_modules/.bin/tamagui-build --skip-native --exclude __tests__",
19
+ "watch": "node ../../../node_modules/.bin/tamagui-build --skip-native --exclude __tests__ --watch",
20
20
  "lint": "biome check src",
21
21
  "lint:fix": "biome check --write src",
22
22
  "test": "vitest --run",
@@ -28,14 +28,12 @@
28
28
  "types": "./types/index.d.ts",
29
29
  "import": "./dist/esm/index.mjs",
30
30
  "require": "./dist/cjs/index.js",
31
- "react-native": "./dist/cjs/index.js",
32
31
  "default": "./dist/cjs/index.js"
33
32
  },
34
33
  "./commonjs": {
35
34
  "types": "./types/commonjs.d.ts",
36
35
  "import": "./dist/esm/commonjs.mjs",
37
- "require": "./dist/cjs/commonjs.js",
38
- "react-native": "./dist/cjs/commonjs.js"
36
+ "require": "./dist/cjs/commonjs.js"
39
37
  }
40
38
  },
41
39
  "dependencies": {
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var commonjs_exports = {};
17
- __export(commonjs_exports, {
18
- default: () => fullySpecifyCommonJS
19
- });
20
- module.exports = __toCommonJS(commonjs_exports);
21
- var import_node_fs = require("node:fs"), import_node_path = require("node:path");
22
- function fullySpecifyCommonJS(api) {
23
- return api.assertVersion(7), {
24
- name: "babel-plugin-fully-specified-cjs",
25
- visitor: {
26
- CallExpression(path, state) {
27
- var callee = path.get("callee");
28
- if (callee.isIdentifier({
29
- name: "require"
30
- }) && path.node.arguments.length === 1) {
31
- var arg = path.node.arguments[0];
32
- if (arg.type === "StringLiteral") {
33
- var moduleSpecifier = arg.value;
34
- if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
35
- var filePath = state.file.opts.filename;
36
- if (!filePath) return;
37
- var fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = ".cjs", jsExtension = ".js";
38
- if (!(0, import_node_path.extname)(moduleSpecifier)) {
39
- var resolvedPath = (0, import_node_path.resolve)(fileDir, moduleSpecifier), newModuleSpecifier = moduleSpecifier;
40
- if (isLocalDirectory(resolvedPath)) {
41
- var indexPath = (0, import_node_path.resolve)(resolvedPath, "index" + jsExtension);
42
- if ((0, import_node_fs.existsSync)(indexPath)) {
43
- newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
44
- return;
45
- }
46
- }
47
- var filePathWithJs = resolvedPath + jsExtension;
48
- if ((0, import_node_fs.existsSync)(filePathWithJs)) {
49
- newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
50
- return;
51
- }
52
- }
53
- }
54
- }
55
- }
56
- }
57
- }
58
- };
59
- }
60
- function isLocalDirectory(absolutePath) {
61
- return (0, import_node_fs.existsSync)(absolutePath) && (0, import_node_fs.lstatSync)(absolutePath).isDirectory();
62
- }
63
- //# sourceMappingURL=commonjs.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/commonjs.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;qBAAsC,oBACtC,mBAA0C;AAE3B,SAAf,qBAA6CA,KAAQ;AACnDA,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,cAAUC,0BAAQL,QAAAA,GAClBM,eAAe,QACfC,cAAc;AAGpB,kBAAI,KAACC,0BAAQX,eAAAA,GAAkB;AAC7B,oBAAMY,mBAAeC,0BAAQN,SAASP,eAAAA,GAClCc,qBAAqBd;AAGzB,oBAAIe,iBAAiBH,YAAAA,GAAe;AAClC,sBAAMI,gBAAYH,0BAAQD,cAAc,UAAUF,WAAAA;AAClD,0BAAIO,2BAAWD,SAAAA,GAAY;AAEzB,oBAAKF,mBAAmBI,SAAS,GAAA,MAC/BJ,sBAAsB,MAExBA,sBAAsB,UAAUL,cAChCX,IAAIG,QAAQa;AACZ;kBACF;gBACF;AAGA,oBAAMK,iBAAiBP,eAAeF;AACtC,wBAAIO,2BAAWE,cAAAA,GAAiB;AAC9BL,wCAAsBL,cACtBX,IAAIG,QAAQa;AACZ;gBACF;cACF;YACF;UACF;QACF;MACF;IACF;EACF;AACF;AAEA,SAASC,iBAAiBK,cAAY;AACpC,aAAOH,2BAAWG,YAAAA,SAAiBC,0BAAUD,YAAAA,EAAcE,YAAW;AACxE;",
5
- "names": ["api", "assertVersion", "name", "visitor", "CallExpression", "path", "state", "callee", "get", "isIdentifier", "node", "arguments", "length", "arg", "type", "moduleSpecifier", "value", "startsWith", "filePath", "file", "opts", "filename", "fileDir", "dirname", "cjsExtension", "jsExtension", "extname", "resolvedPath", "resolve", "newModuleSpecifier", "isLocalDirectory", "indexPath", "existsSync", "endsWith", "filePathWithJs", "absolutePath", "lstatSync", "isDirectory"]
6
- }
@@ -1,133 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
- var index_exports = {};
17
- __export(index_exports, {
18
- default: () => FullySpecified
19
- });
20
- module.exports = __toCommonJS(index_exports);
21
- var import_node_fs = require("node:fs"), import_node_path = require("node:path"), DEFAULT_OPTIONS = {
22
- ensureFileExists: !0,
23
- esExtensionDefault: ".mjs",
24
- tryExtensions: [
25
- ".js"
26
- ],
27
- esExtensions: [
28
- ".mjs"
29
- ]
30
- };
31
- function FullySpecified(api, rawOptions) {
32
- api.assertVersion(7);
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);
46
- }
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
- }
76
- }
77
- }
78
- };
79
- return {
80
- name: "babel-plugin-fully-specified",
81
- visitor: {
82
- ImportDeclaration: importDeclarationVisitor,
83
- ExportNamedDeclaration: exportDeclarationVisitor,
84
- ExportAllDeclaration: exportDeclarationVisitor,
85
- Import: importVisitor
86
- }
87
- };
88
- }
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({
91
- moduleSpecifier: originalModuleSpecifier,
92
- filenameDirectory: fileDir,
93
- filenameExtension: fileExt,
94
- currentModuleExtension,
95
- isDirectory,
96
- tryExtensions,
97
- esExtensions,
98
- esExtensionDefault,
99
- ensureFileExists
100
- });
101
- return targetModule === !1 ? null : targetModule;
102
- }
103
- function isLocalDirectory(absoluteDirectory) {
104
- return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
105
- }
106
- function evaluateTargetModule(param) {
107
- var { moduleSpecifier, currentModuleExtension, isDirectory, filenameDirectory, filenameExtension, tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = param;
108
- if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
109
- return !1;
110
- var targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
111
- if (ensureFileExists) {
112
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
113
- try {
114
- for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
115
- var extension = _step.value;
116
- if ((0, import_node_fs.existsSync)(targetFile + extension))
117
- return moduleSpecifier + esExtensionDefault;
118
- }
119
- } catch (err) {
120
- _didIteratorError = !0, _iteratorError = err;
121
- } finally {
122
- try {
123
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
124
- } finally {
125
- if (_didIteratorError)
126
- throw _iteratorError;
127
- }
128
- }
129
- isDirectory && !(0, import_node_fs.existsSync)((0, import_node_path.resolve)(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
130
- } else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
131
- return !1;
132
- }
133
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;qBAAsC,oBACtC,mBAA0C,sBAmBpCA,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,SAA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B,OAAA,EAAA,6BAAA,QAAA,UAAA,KAAA,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;;;AAOL,IACEsC,eACA,KAACU,+BACCR,0BACEK,mBACAJ,yBAAyBG,kBAAkBA,kBAAkB5C,kBAAAA,CAAAA,MAIjE4C,kBAAkB,GAAGA,eAAAA;EAEzB,MAAO,QAAI1C,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
- }
@@ -1,48 +0,0 @@
1
- import { existsSync, lstatSync } from "node:fs";
2
- import { dirname, extname, resolve } from "node:path";
3
- function fullySpecifyCommonJS(api) {
4
- return api.assertVersion(7), {
5
- name: "babel-plugin-fully-specified-cjs",
6
- visitor: {
7
- CallExpression(path, state) {
8
- var callee = path.get("callee");
9
- if (callee.isIdentifier({
10
- name: "require"
11
- }) && path.node.arguments.length === 1) {
12
- var arg = path.node.arguments[0];
13
- if (arg.type === "StringLiteral") {
14
- var moduleSpecifier = arg.value;
15
- if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
16
- var filePath = state.file.opts.filename;
17
- if (!filePath) return;
18
- var fileDir = dirname(filePath),
19
- cjsExtension = ".cjs",
20
- jsExtension = ".js";
21
- if (!extname(moduleSpecifier)) {
22
- var resolvedPath = resolve(fileDir, moduleSpecifier),
23
- newModuleSpecifier = moduleSpecifier;
24
- if (isLocalDirectory(resolvedPath)) {
25
- var indexPath = resolve(resolvedPath, "index" + jsExtension);
26
- if (existsSync(indexPath)) {
27
- newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
28
- return;
29
- }
30
- }
31
- var filePathWithJs = resolvedPath + jsExtension;
32
- if (existsSync(filePathWithJs)) {
33
- newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
34
- return;
35
- }
36
- }
37
- }
38
- }
39
- }
40
- }
41
- }
42
- };
43
- }
44
- function isLocalDirectory(absolutePath) {
45
- return existsSync(absolutePath) && lstatSync(absolutePath).isDirectory();
46
- }
47
- export { fullySpecifyCommonJS as default };
48
- //# sourceMappingURL=commonjs.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["existsSync","lstatSync","dirname","extname","resolve","fullySpecifyCommonJS","api","assertVersion","name","visitor","CallExpression","path","state","callee","get","isIdentifier","node","arguments","length","arg","type","moduleSpecifier","value","startsWith","filePath","file","opts","filename","fileDir","cjsExtension","jsExtension","resolvedPath","newModuleSpecifier","isLocalDirectory","indexPath","endsWith","filePathWithJs","absolutePath"],"sources":["../../src/commonjs.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,EAAYC,SAAA,QAAiB;AACtC,SAASC,OAAA,EAASC,OAAA,EAASC,OAAA,QAAe;AAE3B,SAARC,qBAAsCC,GAAA,EAA2B;EACtE,OAAAA,GAAA,CAAIC,aAAA,CAAc,CAAC,GAEZ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;EAEA;AACE;AACF,SAAAC,iBAAAI,YAAA","ignoreList":[]}
@@ -1,145 +0,0 @@
1
- import { existsSync, lstatSync } from "node:fs";
2
- import { dirname, extname, resolve } from "node:path";
3
- var DEFAULT_OPTIONS = {
4
- ensureFileExists: !0,
5
- esExtensionDefault: ".mjs",
6
- tryExtensions: [".js"],
7
- esExtensions: [".mjs"]
8
- };
9
- function FullySpecified(api, rawOptions) {
10
- api.assertVersion(7);
11
- var options = {
12
- ...DEFAULT_OPTIONS,
13
- ...rawOptions
14
- },
15
- importDeclarationVisitor = function (path, state) {
16
- var filePath = state.file.opts.filename;
17
- if (filePath) {
18
- var {
19
- node
20
- } = path;
21
- if (node.importKind !== "type") {
22
- var originalModuleSpecifier = node.source.value,
23
- fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
24
- filePath,
25
- options
26
- });
27
- fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
28
- }
29
- }
30
- },
31
- exportDeclarationVisitor = function (path, state) {
32
- var filePath = state.file.opts.filename;
33
- if (filePath) {
34
- var {
35
- node
36
- } = path;
37
- if (node.exportKind !== "type") {
38
- var source = node.source;
39
- if (source) {
40
- var originalModuleSpecifier = source.value,
41
- fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
42
- filePath,
43
- options
44
- });
45
- fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
46
- }
47
- }
48
- }
49
- },
50
- importVisitor = function (path, state) {
51
- var filePath = state.file.opts.filename;
52
- if (filePath) {
53
- var parent = path.parent;
54
- if (parent.type === "CallExpression") {
55
- var firstArgOfImportCall = parent.arguments[0];
56
- if (firstArgOfImportCall.type === "StringLiteral") {
57
- var originalModuleSpecifier = firstArgOfImportCall.value,
58
- fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
59
- filePath,
60
- options
61
- });
62
- fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
63
- }
64
- }
65
- }
66
- };
67
- return {
68
- name: "babel-plugin-fully-specified",
69
- visitor: {
70
- ImportDeclaration: importDeclarationVisitor,
71
- ExportNamedDeclaration: exportDeclarationVisitor,
72
- ExportAllDeclaration: exportDeclarationVisitor,
73
- Import: importVisitor
74
- }
75
- };
76
- }
77
- function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, param) {
78
- var {
79
- filePath,
80
- options
81
- } = param,
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,
111
- currentModuleExtension,
112
- isDirectory,
113
- filenameDirectory,
114
- filenameExtension,
115
- tryExtensions,
116
- esExtensions,
117
- esExtensionDefault,
118
- ensureFileExists
119
- } = param;
120
- if (currentModuleExtension && !esExtensions.includes(currentModuleExtension)) return !1;
121
- var targetFile = resolve(filenameDirectory, moduleSpecifier);
122
- if (ensureFileExists) {
123
- var _iteratorNormalCompletion = !0,
124
- _didIteratorError = !1,
125
- _iteratorError = void 0;
126
- try {
127
- for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
128
- var extension = _step.value;
129
- if (existsSync(targetFile + extension)) return moduleSpecifier + esExtensionDefault;
130
- }
131
- } catch (err) {
132
- _didIteratorError = !0, _iteratorError = err;
133
- } finally {
134
- try {
135
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
136
- } finally {
137
- if (_didIteratorError) throw _iteratorError;
138
- }
139
- }
140
- isDirectory && !existsSync(resolve(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
141
- } else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
142
- return !1;
143
- }
144
- export { FullySpecified as default };
145
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["existsSync","lstatSync","dirname","extname","resolve","DEFAULT_OPTIONS","ensureFileExists","esExtensionDefault","tryExtensions","esExtensions","FullySpecified","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","param","fileExt","fileDir","isDirectory","isLocalDirectory","currentModuleExtension","targetModule","evaluateTargetModule","moduleSpecifier","filenameDirectory","filenameExtension","absoluteDirectory","includes","targetFile","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","extension","err","return"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,EAAYC,SAAA,QAAiB;AACtC,SAASC,OAAA,EAASC,OAAA,EAASC,OAAA,QAAe;AAmB1C,IAAAC,eAAM;EACJC,gBAAA,EAAkB;EAClBC,kBAAA,EAAoB;EACpBC,aAAA,EAAe,CACf,MACF;EAEeC,YAAR,GAIL,MAAI;AASF;AACA,SAAKC,cAAUA,CAAAC,GAAA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