@tamagui/babel-plugin-fully-specified 1.111.7 → 1.111.9

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.
@@ -3,61 +3,67 @@ import { resolve, extname, dirname } from "node:path";
3
3
  var DEFAULT_OPTIONS = {
4
4
  ensureFileExists: !0,
5
5
  esExtensionDefault: ".mjs",
6
- tryExtensions: [
7
- ".js"
8
- ],
9
- esExtensions: [
10
- ".mjs"
11
- ]
6
+ tryExtensions: [".js"],
7
+ esExtensions: [".mjs"]
12
8
  };
13
9
  function FullySpecified(api, rawOptions) {
14
10
  api.assertVersion(7);
15
11
  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);
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
+ }
28
29
  }
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);
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
+ }
42
47
  }
43
48
  }
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);
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
+ }
57
64
  }
58
65
  }
59
- }
60
- };
66
+ };
61
67
  return {
62
68
  name: "babel-plugin-fully-specified",
63
69
  visitor: {
@@ -69,35 +75,59 @@ function FullySpecified(api, rawOptions) {
69
75
  };
70
76
  }
71
77
  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({
73
- moduleSpecifier: originalModuleSpecifier,
74
- filenameDirectory: fileDir,
75
- filenameExtension: fileExt,
76
- currentModuleExtension,
77
- isDirectory,
78
- tryExtensions,
79
- esExtensions,
80
- esExtensionDefault,
81
- ensureFileExists
82
- });
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
+ });
83
103
  return targetModule === !1 ? null : targetModule;
84
104
  }
85
105
  function isLocalDirectory(absoluteDirectory) {
86
106
  return existsSync(absoluteDirectory) && lstatSync(absoluteDirectory).isDirectory();
87
107
  }
88
108
  function evaluateTargetModule(param) {
89
- var { moduleSpecifier, currentModuleExtension, isDirectory, filenameDirectory, filenameExtension, tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = param;
90
- if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
91
- return !1;
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;
92
121
  isDirectory && !existsSync(resolve(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
93
122
  var targetFile = resolve(filenameDirectory, moduleSpecifier);
94
123
  if (ensureFileExists) {
95
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
124
+ var _iteratorNormalCompletion = !0,
125
+ _didIteratorError = !1,
126
+ _iteratorError = void 0;
96
127
  try {
97
128
  for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
98
129
  var extension = _step.value;
99
- if (existsSync(targetFile + extension))
100
- return moduleSpecifier + esExtensionDefault;
130
+ if (existsSync(targetFile + extension)) return moduleSpecifier + esExtensionDefault;
101
131
  }
102
132
  } catch (err) {
103
133
  _didIteratorError = !0, _iteratorError = err;
@@ -105,14 +135,11 @@ function evaluateTargetModule(param) {
105
135
  try {
106
136
  !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
107
137
  } finally {
108
- if (_didIteratorError)
109
- throw _iteratorError;
138
+ if (_didIteratorError) throw _iteratorError;
110
139
  }
111
140
  }
112
141
  } else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
113
142
  return !1;
114
143
  }
115
- export {
116
- FullySpecified as default
117
- };
118
- //# sourceMappingURL=index.js.map
144
+ export { FullySpecified as default };
145
+ //# sourceMappingURL=index.native.js.map
@@ -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,YAA0BC,iBAAiB;AACpD,SAASC,SAASC,SAASC,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AAAA;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
- }
1
+ {"version":3,"names":["existsSync","lstatSync","resolve","extname","dirname","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"],"sources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AS/B,OAAO,OAAAjD,YAAA,CAAA6C,QAAA,CAAAF,iBAAA,GAAAF,eAAA,GAAA3C,kBAAA;EACT","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/babel-plugin-fully-specified",
3
- "version": "1.111.7",
3
+ "version": "1.111.9",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -1,145 +0,0 @@
1
- import { existsSync, lstatSync } from "node:fs";
2
- import { resolve, extname, dirname } 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
- isDirectory && !existsSync(resolve(filenameDirectory, currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault)) && (moduleSpecifier = `${moduleSpecifier}/index`);
122
- var targetFile = resolve(filenameDirectory, moduleSpecifier);
123
- if (ensureFileExists) {
124
- var _iteratorNormalCompletion = !0,
125
- _didIteratorError = !1,
126
- _iteratorError = void 0;
127
- try {
128
- for (var _iterator = tryExtensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
129
- var extension = _step.value;
130
- if (existsSync(targetFile + extension)) return moduleSpecifier + esExtensionDefault;
131
- }
132
- } catch (err) {
133
- _didIteratorError = !0, _iteratorError = err;
134
- } finally {
135
- try {
136
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
137
- } finally {
138
- if (_didIteratorError) throw _iteratorError;
139
- }
140
- }
141
- } else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
142
- return !1;
143
- }
144
- export { FullySpecified as default };
145
- //# sourceMappingURL=index.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["existsSync","lstatSync","resolve","extname","dirname","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,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