@tamagui/babel-plugin-fully-specified 2.0.0-rc.0 → 2.0.0-rc.0-1769998500160

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,23 +1,16 @@
1
1
  {
2
2
  "name": "@tamagui/babel-plugin-fully-specified",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.0-1769998500160",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "license": "MIT",
4
6
  "source": "src/index.ts",
5
- "main": "permanent/cjs/index.js",
6
- "module": "permanent/esm/index.mjs",
7
7
  "files": [
8
8
  "src",
9
9
  "types",
10
10
  "permanent"
11
11
  ],
12
- "license": "MIT",
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "scripts": {
17
- "lint": "biome check src",
18
- "lint:fix": "biome check --write src",
19
- "test": "vitest --run"
20
- },
12
+ "main": "permanent/cjs/index.js",
13
+ "module": "permanent/esm/index.mjs",
21
14
  "exports": {
22
15
  ".": {
23
16
  "types": "./types/index.d.ts",
@@ -33,12 +26,17 @@
33
26
  "require": "./permanent/cjs/commonjs.js"
34
27
  }
35
28
  },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "scripts": {
33
+ "test": "vitest --run"
34
+ },
36
35
  "dependencies": {
37
36
  "@babel/core": "^7.25.2"
38
37
  },
39
38
  "devDependencies": {
40
39
  "@babel/types": "^7.25.4",
41
- "vitest": "^4.0.4"
42
- },
43
- "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
44
- }
40
+ "vitest": "4.0.4"
41
+ }
42
+ }
@@ -1,60 +1,86 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1
+ var __defProp = Object.defineProperty
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor
3
+ var __getOwnPropNames = Object.getOwnPropertyNames
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty
5
5
  var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var commonjs_exports = {};
6
+ for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 })
7
+ },
8
+ __copyProps = (to, from, except, desc) => {
9
+ if ((from && typeof from == 'object') || typeof from == 'function')
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) &&
12
+ key !== except &&
13
+ __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
16
+ })
17
+ return to
18
+ }
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, '__esModule', { value: !0 }), mod)
20
+ var commonjs_exports = {}
16
21
  __export(commonjs_exports, {
17
- default: () => fullySpecifyCommonJS
18
- });
19
- module.exports = __toCommonJS(commonjs_exports);
20
- var import_node_fs = require("node:fs"), import_node_path = require("node:path");
22
+ default: () => fullySpecifyCommonJS,
23
+ })
24
+ module.exports = __toCommonJS(commonjs_exports)
25
+ var import_node_fs = require('node:fs'),
26
+ import_node_path = require('node:path')
21
27
  function fullySpecifyCommonJS(api, options) {
22
- return api.assertVersion(7), {
23
- name: "babel-plugin-fully-specified-cjs",
24
- visitor: {
25
- CallExpression(path, state) {
26
- if (path.get("callee").isIdentifier({ name: "require" }) && path.node.arguments.length === 1) {
27
- const arg = path.node.arguments[0];
28
- if (arg.type === "StringLiteral") {
29
- let moduleSpecifier = arg.value;
30
- if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
31
- const filePath = state.file.opts.filename;
32
- if (!filePath) return;
33
- const fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = options.esExtensionDefault || ".cjs", jsExtension = ".js";
34
- if (!(0, import_node_path.extname)(moduleSpecifier)) {
35
- const resolvedPath = (0, import_node_path.resolve)(fileDir, moduleSpecifier);
36
- let newModuleSpecifier = moduleSpecifier;
37
- if (isLocalDirectory(resolvedPath)) {
38
- const indexPath = (0, import_node_path.resolve)(resolvedPath, "index" + jsExtension);
39
- if ((0, import_node_fs.existsSync)(indexPath)) {
40
- newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
41
- return;
28
+ return (
29
+ api.assertVersion(7),
30
+ {
31
+ name: 'babel-plugin-fully-specified-cjs',
32
+ visitor: {
33
+ CallExpression(path, state) {
34
+ if (
35
+ path.get('callee').isIdentifier({ name: 'require' }) &&
36
+ path.node.arguments.length === 1
37
+ ) {
38
+ const arg = path.node.arguments[0]
39
+ if (arg.type === 'StringLiteral') {
40
+ let moduleSpecifier = arg.value
41
+ if (moduleSpecifier.startsWith('.') || moduleSpecifier.startsWith('/')) {
42
+ const filePath = state.file.opts.filename
43
+ if (!filePath) return
44
+ const fileDir = (0, import_node_path.dirname)(filePath),
45
+ cjsExtension = options.esExtensionDefault || '.cjs',
46
+ jsExtension = '.js'
47
+ if (!(0, import_node_path.extname)(moduleSpecifier)) {
48
+ const resolvedPath = (0, import_node_path.resolve)(
49
+ fileDir,
50
+ moduleSpecifier
51
+ )
52
+ let newModuleSpecifier = moduleSpecifier
53
+ if (isLocalDirectory(resolvedPath)) {
54
+ const indexPath = (0, import_node_path.resolve)(
55
+ resolvedPath,
56
+ 'index' + jsExtension
57
+ )
58
+ if ((0, import_node_fs.existsSync)(indexPath)) {
59
+ ;(newModuleSpecifier.endsWith('/') || (newModuleSpecifier += '/'),
60
+ (newModuleSpecifier += 'index' + cjsExtension),
61
+ (arg.value = newModuleSpecifier))
62
+ return
63
+ }
64
+ }
65
+ const filePathWithJs = resolvedPath + jsExtension
66
+ if ((0, import_node_fs.existsSync)(filePathWithJs)) {
67
+ ;((newModuleSpecifier += cjsExtension),
68
+ (arg.value = newModuleSpecifier))
69
+ return
42
70
  }
43
- }
44
- const filePathWithJs = resolvedPath + jsExtension;
45
- if ((0, import_node_fs.existsSync)(filePathWithJs)) {
46
- newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
47
- return;
48
71
  }
49
72
  }
50
73
  }
51
74
  }
52
- }
53
- }
75
+ },
76
+ },
54
77
  }
55
- };
78
+ )
56
79
  }
57
80
  function isLocalDirectory(absolutePath) {
58
- return (0, import_node_fs.existsSync)(absolutePath) && (0, import_node_fs.lstatSync)(absolutePath).isDirectory();
81
+ return (
82
+ (0, import_node_fs.existsSync)(absolutePath) &&
83
+ (0, import_node_fs.lstatSync)(absolutePath).isDirectory()
84
+ )
59
85
  }
60
86
  //# sourceMappingURL=commonjs.js.map
@@ -1,71 +1,98 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1
+ var __defProp = Object.defineProperty
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor
3
+ var __getOwnPropNames = Object.getOwnPropertyNames
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
6
+ for (var name in all)
7
+ __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: !0,
10
+ })
10
11
  },
11
12
  __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var commonjs_exports = {};
13
+ if ((from && typeof from == 'object') || typeof from == 'function')
14
+ for (let key of __getOwnPropNames(from))
15
+ !__hasOwnProp.call(to, key) &&
16
+ key !== except &&
17
+ __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
20
+ })
21
+ return to
22
+ }
23
+ var __toCommonJS = (mod) =>
24
+ __copyProps(
25
+ __defProp({}, '__esModule', {
26
+ value: !0,
27
+ }),
28
+ mod
29
+ )
30
+ var commonjs_exports = {}
22
31
  __export(commonjs_exports, {
23
- default: () => fullySpecifyCommonJS
24
- });
25
- module.exports = __toCommonJS(commonjs_exports);
26
- var import_node_fs = require("node:fs"),
27
- import_node_path = require("node:path");
32
+ default: () => fullySpecifyCommonJS,
33
+ })
34
+ module.exports = __toCommonJS(commonjs_exports)
35
+ var import_node_fs = require('node:fs'),
36
+ import_node_path = require('node:path')
28
37
  function fullySpecifyCommonJS(api, options) {
29
- return api.assertVersion(7), {
30
- name: "babel-plugin-fully-specified-cjs",
31
- visitor: {
32
- CallExpression(path, state) {
33
- if (path.get("callee").isIdentifier({
34
- name: "require"
35
- }) && path.node.arguments.length === 1) {
36
- const arg = path.node.arguments[0];
37
- if (arg.type === "StringLiteral") {
38
- let moduleSpecifier = arg.value;
39
- if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
40
- const filePath = state.file.opts.filename;
41
- if (!filePath) return;
42
- const fileDir = (0, import_node_path.dirname)(filePath),
43
- cjsExtension = options.esExtensionDefault || ".cjs",
44
- jsExtension = ".js";
45
- if (!(0, import_node_path.extname)(moduleSpecifier)) {
46
- const resolvedPath = (0, import_node_path.resolve)(fileDir, moduleSpecifier);
47
- let newModuleSpecifier = moduleSpecifier;
48
- if (isLocalDirectory(resolvedPath)) {
49
- const indexPath = (0, import_node_path.resolve)(resolvedPath, "index" + jsExtension);
50
- if ((0, import_node_fs.existsSync)(indexPath)) {
51
- newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
52
- return;
38
+ return (
39
+ api.assertVersion(7),
40
+ {
41
+ name: 'babel-plugin-fully-specified-cjs',
42
+ visitor: {
43
+ CallExpression(path, state) {
44
+ if (
45
+ path.get('callee').isIdentifier({
46
+ name: 'require',
47
+ }) &&
48
+ path.node.arguments.length === 1
49
+ ) {
50
+ const arg = path.node.arguments[0]
51
+ if (arg.type === 'StringLiteral') {
52
+ let moduleSpecifier = arg.value
53
+ if (moduleSpecifier.startsWith('.') || moduleSpecifier.startsWith('/')) {
54
+ const filePath = state.file.opts.filename
55
+ if (!filePath) return
56
+ const fileDir = (0, import_node_path.dirname)(filePath),
57
+ cjsExtension = options.esExtensionDefault || '.cjs',
58
+ jsExtension = '.js'
59
+ if (!(0, import_node_path.extname)(moduleSpecifier)) {
60
+ const resolvedPath = (0, import_node_path.resolve)(
61
+ fileDir,
62
+ moduleSpecifier
63
+ )
64
+ let newModuleSpecifier = moduleSpecifier
65
+ if (isLocalDirectory(resolvedPath)) {
66
+ const indexPath = (0, import_node_path.resolve)(
67
+ resolvedPath,
68
+ 'index' + jsExtension
69
+ )
70
+ if ((0, import_node_fs.existsSync)(indexPath)) {
71
+ ;(newModuleSpecifier.endsWith('/') || (newModuleSpecifier += '/'),
72
+ (newModuleSpecifier += 'index' + cjsExtension),
73
+ (arg.value = newModuleSpecifier))
74
+ return
75
+ }
76
+ }
77
+ const filePathWithJs = resolvedPath + jsExtension
78
+ if ((0, import_node_fs.existsSync)(filePathWithJs)) {
79
+ ;((newModuleSpecifier += cjsExtension),
80
+ (arg.value = newModuleSpecifier))
81
+ return
53
82
  }
54
- }
55
- const filePathWithJs = resolvedPath + jsExtension;
56
- if ((0, import_node_fs.existsSync)(filePathWithJs)) {
57
- newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
58
- return;
59
83
  }
60
84
  }
61
85
  }
62
86
  }
63
- }
64
- }
87
+ },
88
+ },
65
89
  }
66
- };
90
+ )
67
91
  }
68
92
  function isLocalDirectory(absolutePath) {
69
- return (0, import_node_fs.existsSync)(absolutePath) && (0, import_node_fs.lstatSync)(absolutePath).isDirectory();
93
+ return (
94
+ (0, import_node_fs.existsSync)(absolutePath) &&
95
+ (0, import_node_fs.lstatSync)(absolutePath).isDirectory()
96
+ )
70
97
  }
71
98
  //# sourceMappingURL=commonjs.mjs.map
@@ -1,127 +1,161 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
1
+ var __create = Object.create
2
+ var __defProp = Object.defineProperty
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor
4
+ var __getOwnPropNames = Object.getOwnPropertyNames
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty
6
7
  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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var index_exports = {};
8
+ for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 })
9
+ },
10
+ __copyProps = (to, from, except, desc) => {
11
+ if ((from && typeof from == 'object') || typeof from == 'function')
12
+ for (let key of __getOwnPropNames(from))
13
+ !__hasOwnProp.call(to, key) &&
14
+ key !== except &&
15
+ __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
18
+ })
19
+ return to
20
+ }
21
+ var __toESM = (mod, isNodeMode, target) => (
22
+ (target = mod != null ? __create(__getProtoOf(mod)) : {}),
23
+ __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule
29
+ ? __defProp(target, 'default', { value: mod, enumerable: !0 })
30
+ : target,
31
+ mod
32
+ )
33
+ ),
34
+ __toCommonJS = (mod) => __copyProps(__defProp({}, '__esModule', { value: !0 }), mod)
35
+ var index_exports = {}
24
36
  __export(index_exports, {
25
- default: () => FullySpecified
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
- var import_node_fs = require("node:fs"), import_node_path = require("node:path"), t = __toESM(require("@babel/types"));
37
+ default: () => FullySpecified,
38
+ })
39
+ module.exports = __toCommonJS(index_exports)
40
+ var import_node_fs = require('node:fs'),
41
+ import_node_path = require('node:path'),
42
+ t = __toESM(require('@babel/types'))
29
43
  const DEFAULT_OPTIONS = {
30
44
  ensureFileExists: !0,
31
- esExtensionDefault: ".mjs",
32
- tryExtensions: [".js"],
33
- esExtensions: [".mjs"],
34
- convertProcessEnvToImportMetaEnv: !1
35
- };
45
+ esExtensionDefault: '.mjs',
46
+ tryExtensions: ['.js'],
47
+ esExtensions: ['.mjs'],
48
+ convertProcessEnvToImportMetaEnv: !1,
49
+ }
36
50
  function FullySpecified(api, rawOptions) {
37
- api.assertVersion(7);
38
- const options = { ...DEFAULT_OPTIONS, ...rawOptions }, importDeclarationVisitor = (path, state) => {
39
- const filePath = state.file.opts.filename;
40
- if (!filePath) return;
41
- const { node } = path;
42
- if (node.importKind === "type") return;
43
- const originalModuleSpecifier = node.source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
44
- originalModuleSpecifier,
45
- {
46
- filePath,
47
- options
48
- }
49
- );
50
- fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier);
51
- }, exportDeclarationVisitor = (path, state) => {
52
- const filePath = state.file.opts.filename;
53
- if (!filePath) return;
54
- const { node } = path;
55
- if (node.exportKind === "type") return;
56
- const source = node.source;
57
- if (!source) return;
58
- const originalModuleSpecifier = source.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
59
- originalModuleSpecifier,
60
- {
61
- filePath,
62
- options
63
- }
64
- );
65
- fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier);
66
- };
51
+ api.assertVersion(7)
52
+ const options = { ...DEFAULT_OPTIONS, ...rawOptions },
53
+ importDeclarationVisitor = (path, state) => {
54
+ const filePath = state.file.opts.filename
55
+ if (!filePath) return
56
+ const { node } = path
57
+ if (node.importKind === 'type') return
58
+ const originalModuleSpecifier = node.source.value,
59
+ fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
60
+ originalModuleSpecifier,
61
+ {
62
+ filePath,
63
+ options,
64
+ }
65
+ )
66
+ fullySpecifiedModuleSpecifier && (node.source.value = fullySpecifiedModuleSpecifier)
67
+ },
68
+ exportDeclarationVisitor = (path, state) => {
69
+ const filePath = state.file.opts.filename
70
+ if (!filePath) return
71
+ const { node } = path
72
+ if (node.exportKind === 'type') return
73
+ const source = node.source
74
+ if (!source) return
75
+ const originalModuleSpecifier = source.value,
76
+ fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
77
+ originalModuleSpecifier,
78
+ {
79
+ filePath,
80
+ options,
81
+ }
82
+ )
83
+ fullySpecifiedModuleSpecifier && (source.value = fullySpecifiedModuleSpecifier)
84
+ }
67
85
  return {
68
- name: "babel-plugin-fully-specified",
86
+ name: 'babel-plugin-fully-specified',
69
87
  visitor: {
70
88
  ImportDeclaration: importDeclarationVisitor,
71
89
  ExportNamedDeclaration: exportDeclarationVisitor,
72
90
  ExportAllDeclaration: exportDeclarationVisitor,
73
91
  Import: (path, state) => {
74
- const filePath = state.file.opts.filename;
75
- if (!filePath) return;
76
- const parent = path.parent;
77
- if (parent.type !== "CallExpression")
78
- return;
79
- const firstArgOfImportCall = parent.arguments[0];
80
- if (firstArgOfImportCall.type !== "StringLiteral")
81
- return;
82
- const originalModuleSpecifier = firstArgOfImportCall.value, fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
83
- originalModuleSpecifier,
84
- {
85
- filePath,
86
- options
87
- }
88
- );
89
- fullySpecifiedModuleSpecifier && (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier);
92
+ const filePath = state.file.opts.filename
93
+ if (!filePath) return
94
+ const parent = path.parent
95
+ if (parent.type !== 'CallExpression') return
96
+ const firstArgOfImportCall = parent.arguments[0]
97
+ if (firstArgOfImportCall.type !== 'StringLiteral') return
98
+ const originalModuleSpecifier = firstArgOfImportCall.value,
99
+ fullySpecifiedModuleSpecifier = getFullySpecifiedModuleSpecifier(
100
+ originalModuleSpecifier,
101
+ {
102
+ filePath,
103
+ options,
104
+ }
105
+ )
106
+ fullySpecifiedModuleSpecifier &&
107
+ (firstArgOfImportCall.value = fullySpecifiedModuleSpecifier)
90
108
  },
91
109
  MemberExpression: (path) => {
92
- if (!options.convertProcessEnvToImportMetaEnv) return;
93
- const { node } = path;
94
- if (node.object.type === "MemberExpression" && node.object.object.type === "Identifier" && node.object.object.name === "process" && node.object.property.type === "Identifier" && node.object.property.name === "env") {
95
- if (node.property.type === "Identifier" && node.property.name === "NODE_ENV")
96
- return;
110
+ if (!options.convertProcessEnvToImportMetaEnv) return
111
+ const { node } = path
112
+ if (
113
+ node.object.type === 'MemberExpression' &&
114
+ node.object.object.type === 'Identifier' &&
115
+ node.object.object.name === 'process' &&
116
+ node.object.property.type === 'Identifier' &&
117
+ node.object.property.name === 'env'
118
+ ) {
119
+ if (node.property.type === 'Identifier' && node.property.name === 'NODE_ENV')
120
+ return
97
121
  node.object = t.memberExpression(
98
- t.metaProperty(t.identifier("import"), t.identifier("meta")),
99
- t.identifier("env")
100
- );
122
+ t.metaProperty(t.identifier('import'), t.identifier('meta')),
123
+ t.identifier('env')
124
+ )
101
125
  }
102
- }
103
- }
104
- };
126
+ },
127
+ },
128
+ }
105
129
  }
106
- function getFullySpecifiedModuleSpecifier(originalModuleSpecifier, {
107
- filePath,
108
- options
109
- }) {
110
- 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({
111
- moduleSpecifier: originalModuleSpecifier,
112
- filenameDirectory: fileDir,
113
- filenameExtension: fileExt,
114
- currentModuleExtension,
115
- isDirectory,
116
- tryExtensions,
117
- esExtensions,
118
- esExtensionDefault,
119
- ensureFileExists
120
- });
121
- return targetModule === !1 ? null : targetModule;
130
+ function getFullySpecifiedModuleSpecifier(
131
+ originalModuleSpecifier,
132
+ { filePath, options }
133
+ ) {
134
+ const fileExt = (0, import_node_path.extname)(filePath),
135
+ fileDir = (0, import_node_path.dirname)(filePath),
136
+ isDirectory = isLocalDirectory(
137
+ (0, import_node_path.resolve)(fileDir, originalModuleSpecifier)
138
+ ),
139
+ currentModuleExtension = (0, import_node_path.extname)(originalModuleSpecifier),
140
+ { tryExtensions, esExtensions, esExtensionDefault, ensureFileExists } = options,
141
+ targetModule = evaluateTargetModule({
142
+ moduleSpecifier: originalModuleSpecifier,
143
+ filenameDirectory: fileDir,
144
+ filenameExtension: fileExt,
145
+ currentModuleExtension,
146
+ isDirectory,
147
+ tryExtensions,
148
+ esExtensions,
149
+ esExtensionDefault,
150
+ ensureFileExists,
151
+ })
152
+ return targetModule === !1 ? null : targetModule
122
153
  }
123
154
  function isLocalDirectory(absoluteDirectory) {
124
- return (0, import_node_fs.existsSync)(absoluteDirectory) && (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory();
155
+ return (
156
+ (0, import_node_fs.existsSync)(absoluteDirectory) &&
157
+ (0, import_node_fs.lstatSync)(absoluteDirectory).isDirectory()
158
+ )
125
159
  }
126
160
  function evaluateTargetModule({
127
161
  moduleSpecifier,
@@ -132,22 +166,26 @@ function evaluateTargetModule({
132
166
  tryExtensions,
133
167
  esExtensions,
134
168
  esExtensionDefault,
135
- ensureFileExists
169
+ ensureFileExists,
136
170
  }) {
137
- if (currentModuleExtension && !esExtensions.includes(currentModuleExtension))
138
- return !1;
139
- const targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier);
171
+ if (currentModuleExtension && !esExtensions.includes(currentModuleExtension)) return !1
172
+ const targetFile = (0, import_node_path.resolve)(filenameDirectory, moduleSpecifier)
140
173
  if (ensureFileExists) {
141
174
  for (const extension of tryExtensions)
142
175
  if ((0, import_node_fs.existsSync)(targetFile + extension))
143
- return moduleSpecifier + esExtensionDefault;
144
- isDirectory && !(0, import_node_fs.existsSync)(
145
- (0, import_node_path.resolve)(
146
- filenameDirectory,
147
- currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
148
- )
149
- ) && (moduleSpecifier = `${moduleSpecifier}/index`);
150
- } else return esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault;
151
- return !1;
176
+ return moduleSpecifier + esExtensionDefault
177
+ isDirectory &&
178
+ !(0, import_node_fs.existsSync)(
179
+ (0, import_node_path.resolve)(
180
+ filenameDirectory,
181
+ currentModuleExtension ? moduleSpecifier : moduleSpecifier + esExtensionDefault
182
+ )
183
+ ) &&
184
+ (moduleSpecifier = `${moduleSpecifier}/index`)
185
+ } else
186
+ return (
187
+ esExtensions.includes(filenameExtension), moduleSpecifier + esExtensionDefault
188
+ )
189
+ return !1
152
190
  }
153
191
  //# sourceMappingURL=index.js.map