@tamagui/babel-plugin-fully-specified 1.116.1 → 1.116.3
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/commonjs.js +4 -4
- package/dist/cjs/commonjs.js.map +1 -1
- package/dist/cjs/commonjs.native.js +4 -4
- package/dist/cjs/commonjs.native.js.map +2 -2
- package/dist/esm/commonjs.js +4 -4
- package/dist/esm/commonjs.js.map +1 -1
- package/dist/esm/commonjs.mjs +5 -4
- package/dist/esm/commonjs.mjs.map +1 -1
- package/dist/esm/commonjs.native.js +4 -4
- package/dist/esm/commonjs.native.js.map +2 -2
- package/package.json +1 -1
- package/src/commonjs.ts +4 -3
- package/types/commonjs.d.ts.map +1 -1
package/dist/cjs/commonjs.js
CHANGED
|
@@ -30,19 +30,19 @@ function fullySpecifyCommonJS(api) {
|
|
|
30
30
|
if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
|
|
31
31
|
const filePath = state.file.opts.filename;
|
|
32
32
|
if (!filePath) return;
|
|
33
|
-
const fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = ".cjs";
|
|
33
|
+
const fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = ".cjs", jsExtension = ".js";
|
|
34
34
|
if (!(0, import_node_path.extname)(moduleSpecifier)) {
|
|
35
35
|
const resolvedPath = (0, import_node_path.resolve)(fileDir, moduleSpecifier);
|
|
36
36
|
let newModuleSpecifier = moduleSpecifier;
|
|
37
37
|
if (isLocalDirectory(resolvedPath)) {
|
|
38
|
-
const indexPath = (0, import_node_path.resolve)(resolvedPath, "index" +
|
|
38
|
+
const indexPath = (0, import_node_path.resolve)(resolvedPath, "index" + jsExtension);
|
|
39
39
|
if ((0, import_node_fs.existsSync)(indexPath)) {
|
|
40
40
|
newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
if ((0, import_node_fs.existsSync)(
|
|
44
|
+
const filePathWithJs = resolvedPath + jsExtension;
|
|
45
|
+
if ((0, import_node_fs.existsSync)(filePathWithJs)) {
|
|
46
46
|
newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
|
|
47
47
|
return;
|
|
48
48
|
}
|
package/dist/cjs/commonjs.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commonjs.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC,oBACtC,mBAA0C;AAE3B,SAAR,qBAAsC,KAAK;AAChD,aAAI,cAAc,CAAC,GAEZ;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,eAAe,MAAM,OAAO;AAG1B,YAFe,KAAK,IAAI,QAAQ,EAGvB,aAAa,EAAE,MAAM,UAAU,CAAC,KACvC,KAAK,KAAK,UAAU,WAAW,GAC/B;AACA,gBAAM,MAAM,KAAK,KAAK,UAAU,CAAC;AACjC,cAAI,IAAI,SAAS,iBAAiB;AAChC,gBAAI,kBAAkB,IAAI;AAG1B,gBAAI,gBAAgB,WAAW,GAAG,KAAK,gBAAgB,WAAW,GAAG,GAAG;AACtE,oBAAM,WAAW,MAAM,KAAK,KAAK;AACjC,kBAAI,CAAC,SAAU;AAEf,oBAAM,cAAU,0BAAQ,QAAQ,GAC1B,eAAe;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC,oBACtC,mBAA0C;AAE3B,SAAR,qBAAsC,KAAK;AAChD,aAAI,cAAc,CAAC,GAEZ;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,eAAe,MAAM,OAAO;AAG1B,YAFe,KAAK,IAAI,QAAQ,EAGvB,aAAa,EAAE,MAAM,UAAU,CAAC,KACvC,KAAK,KAAK,UAAU,WAAW,GAC/B;AACA,gBAAM,MAAM,KAAK,KAAK,UAAU,CAAC;AACjC,cAAI,IAAI,SAAS,iBAAiB;AAChC,gBAAI,kBAAkB,IAAI;AAG1B,gBAAI,gBAAgB,WAAW,GAAG,KAAK,gBAAgB,WAAW,GAAG,GAAG;AACtE,oBAAM,WAAW,MAAM,KAAK,KAAK;AACjC,kBAAI,CAAC,SAAU;AAEf,oBAAM,cAAU,0BAAQ,QAAQ,GAC1B,eAAe,QACf,cAAc;AAGpB,kBAAI,KAAC,0BAAQ,eAAe,GAAG;AAC7B,sBAAM,mBAAe,0BAAQ,SAAS,eAAe;AACrD,oBAAI,qBAAqB;AAGzB,oBAAI,iBAAiB,YAAY,GAAG;AAClC,wBAAM,gBAAY,0BAAQ,cAAc,UAAU,WAAW;AAC7D,0BAAI,2BAAW,SAAS,GAAG;AAEzB,oBAAK,mBAAmB,SAAS,GAAG,MAClC,sBAAsB,MAExB,sBAAsB,UAAU,cAChC,IAAI,QAAQ;AACZ;AAAA,kBACF;AAAA,gBACF;AAGA,sBAAM,iBAAiB,eAAe;AACtC,wBAAI,2BAAW,cAAc,GAAG;AAC9B,wCAAsB,cACtB,IAAI,QAAQ;AACZ;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,iBAAiB,cAAc;AACtC,aAAO,2BAAW,YAAY,SAAK,0BAAU,YAAY,EAAE,YAAY;AACzE;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -34,18 +34,18 @@ function fullySpecifyCommonJS(api) {
|
|
|
34
34
|
if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
|
|
35
35
|
var filePath = state.file.opts.filename;
|
|
36
36
|
if (!filePath) return;
|
|
37
|
-
var fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = ".cjs";
|
|
37
|
+
var fileDir = (0, import_node_path.dirname)(filePath), cjsExtension = ".cjs", jsExtension = ".js";
|
|
38
38
|
if (!(0, import_node_path.extname)(moduleSpecifier)) {
|
|
39
39
|
var resolvedPath = (0, import_node_path.resolve)(fileDir, moduleSpecifier), newModuleSpecifier = moduleSpecifier;
|
|
40
40
|
if (isLocalDirectory(resolvedPath)) {
|
|
41
|
-
var indexPath = (0, import_node_path.resolve)(resolvedPath, "index" +
|
|
41
|
+
var indexPath = (0, import_node_path.resolve)(resolvedPath, "index" + jsExtension);
|
|
42
42
|
if ((0, import_node_fs.existsSync)(indexPath)) {
|
|
43
43
|
newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
if ((0, import_node_fs.existsSync)(
|
|
47
|
+
var filePathWithJs = resolvedPath + jsExtension;
|
|
48
|
+
if ((0, import_node_fs.existsSync)(filePathWithJs)) {
|
|
49
49
|
newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/packages/babel-plugin-fully-specified/src/commonjs.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;qBAAsC,oBACtC,mBAA0C;AAE3B,SAAf,qBAA6CA,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,cAAUC,0BAAQL,QAAAA,GAClBM,eAAe;
|
|
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", "extname", "resolvedPath", "resolve", "newModuleSpecifier", "isLocalDirectory", "indexPath", "existsSync", "endsWith", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;qBAAsC,oBACtC,mBAA0C;AAE3B,SAAf,qBAA6CA,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,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
6
|
}
|
package/dist/esm/commonjs.js
CHANGED
|
@@ -12,19 +12,19 @@ function fullySpecifyCommonJS(api) {
|
|
|
12
12
|
if (moduleSpecifier.startsWith(".") || moduleSpecifier.startsWith("/")) {
|
|
13
13
|
const filePath = state.file.opts.filename;
|
|
14
14
|
if (!filePath) return;
|
|
15
|
-
const fileDir = dirname(filePath), cjsExtension = ".cjs";
|
|
15
|
+
const fileDir = dirname(filePath), cjsExtension = ".cjs", jsExtension = ".js";
|
|
16
16
|
if (!extname(moduleSpecifier)) {
|
|
17
17
|
const resolvedPath = resolve(fileDir, moduleSpecifier);
|
|
18
18
|
let newModuleSpecifier = moduleSpecifier;
|
|
19
19
|
if (isLocalDirectory(resolvedPath)) {
|
|
20
|
-
const indexPath = resolve(resolvedPath, "index" +
|
|
20
|
+
const indexPath = resolve(resolvedPath, "index" + jsExtension);
|
|
21
21
|
if (existsSync(indexPath)) {
|
|
22
22
|
newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
if (existsSync(
|
|
26
|
+
const filePathWithJs = resolvedPath + jsExtension;
|
|
27
|
+
if (existsSync(filePathWithJs)) {
|
|
28
28
|
newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
|
|
29
29
|
return;
|
|
30
30
|
}
|
package/dist/esm/commonjs.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commonjs.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,SAAS,SAAS,eAAe;AAE3B,SAAR,qBAAsC,KAAK;AAChD,aAAI,cAAc,CAAC,GAEZ;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,eAAe,MAAM,OAAO;AAG1B,YAFe,KAAK,IAAI,QAAQ,EAGvB,aAAa,EAAE,MAAM,UAAU,CAAC,KACvC,KAAK,KAAK,UAAU,WAAW,GAC/B;AACA,gBAAM,MAAM,KAAK,KAAK,UAAU,CAAC;AACjC,cAAI,IAAI,SAAS,iBAAiB;AAChC,gBAAI,kBAAkB,IAAI;AAG1B,gBAAI,gBAAgB,WAAW,GAAG,KAAK,gBAAgB,WAAW,GAAG,GAAG;AACtE,oBAAM,WAAW,MAAM,KAAK,KAAK;AACjC,kBAAI,CAAC,SAAU;AAEf,oBAAM,UAAU,QAAQ,QAAQ,GAC1B,eAAe;
|
|
4
|
+
"mappings": "AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,SAAS,SAAS,eAAe;A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api) {
|
|
|
15
15
|
const filePath = state.file.opts.filename;
|
|
16
16
|
if (!filePath) return;
|
|
17
17
|
const fileDir = dirname(filePath),
|
|
18
|
-
cjsExtension = ".cjs"
|
|
18
|
+
cjsExtension = ".cjs",
|
|
19
|
+
jsExtension = ".js";
|
|
19
20
|
if (!extname(moduleSpecifier)) {
|
|
20
21
|
const resolvedPath = resolve(fileDir, moduleSpecifier);
|
|
21
22
|
let newModuleSpecifier = moduleSpecifier;
|
|
22
23
|
if (isLocalDirectory(resolvedPath)) {
|
|
23
|
-
const indexPath = resolve(resolvedPath, "index" +
|
|
24
|
+
const indexPath = resolve(resolvedPath, "index" + jsExtension);
|
|
24
25
|
if (existsSync(indexPath)) {
|
|
25
26
|
newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
if (existsSync(
|
|
30
|
+
const filePathWithJs = resolvedPath + jsExtension;
|
|
31
|
+
if (existsSync(filePathWithJs)) {
|
|
31
32
|
newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["existsSync","lstatSync","dirname","extname","resolve","fullySpecifyCommonJS","api","assertVersion","name","visitor","CallExpression","path","state","get","isIdentifier","node","arguments","length","arg","type","moduleSpecifier","value","startsWith","filePath","file","opts","filename","fileDir","cjsExtension","resolvedPath","newModuleSpecifier","isLocalDirectory","indexPath","endsWith","
|
|
1
|
+
{"version":3,"names":["existsSync","lstatSync","dirname","extname","resolve","fullySpecifyCommonJS","api","assertVersion","name","visitor","CallExpression","path","state","get","isIdentifier","node","arguments","length","arg","type","moduleSpecifier","value","startsWith","filePath","file","opts","filename","fileDir","cjsExtension","jsExtension","resolvedPath","newModuleSpecifier","isLocalDirectory","indexPath","endsWith","fil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AEpBF,kBAAA,CAAmBG,QAAA,CAAS,GAAG,MAClCH,kBAAA,IAAsB,MAExBA,kBAAA,IAAsB,UAAUH,YAAA,EAChCV,GAAA,CAAIG,KAAA,GAAQU,kBAAA;oBACZ;kBACF;gBACF;gBAGA,MAAMI,cAAA,GAAiBL,YAAA,GAAeD,WAAA;gBACtC,IAAI7B,UAAA,CAAWmC,cAAc,GAAG;kBAC9BJ,kBAAA,IAAsBH,YAAA,EACtBV,GAAA,CAAIG,KAAA,GAAQU,kBAAA;kBACZ;gBACF;cACF;YACF;UACF;QACF;MACF;IACF;EACF;AACF;AAEA,SAASC,iBAAiBI,YAAA,EAAc;EACtC,OAAOpC,UAAA,CAAWoC,YAAY,KAAKnC,SAAA,CAAUmC,YAAY,EAAEC,WAAA,CAAY;AACzE","ignoreList":[]}
|
|
@@ -15,18 +15,18 @@ 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), cjsExtension = ".cjs";
|
|
18
|
+
var fileDir = dirname(filePath), cjsExtension = ".cjs", jsExtension = ".js";
|
|
19
19
|
if (!extname(moduleSpecifier)) {
|
|
20
20
|
var resolvedPath = resolve(fileDir, moduleSpecifier), newModuleSpecifier = moduleSpecifier;
|
|
21
21
|
if (isLocalDirectory(resolvedPath)) {
|
|
22
|
-
var indexPath = resolve(resolvedPath, "index" +
|
|
22
|
+
var indexPath = resolve(resolvedPath, "index" + jsExtension);
|
|
23
23
|
if (existsSync(indexPath)) {
|
|
24
24
|
newModuleSpecifier.endsWith("/") || (newModuleSpecifier += "/"), newModuleSpecifier += "index" + cjsExtension, arg.value = newModuleSpecifier;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
if (existsSync(
|
|
28
|
+
var filePathWithJs = resolvedPath + jsExtension;
|
|
29
|
+
if (existsSync(filePathWithJs)) {
|
|
30
30
|
newModuleSpecifier += cjsExtension, arg.value = newModuleSpecifier;
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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;
|
|
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", "
|
|
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,QACfC,cAAc;AAGpB,kBAAI,CAAC1B,QAAQiB,eAAAA,GAAkB;AAC7B,oBAAMU,eAAe1B,QAAQuB,SAASP,eAAAA,GAClCW,qBAAqBX;AAGzB,oBAAIY,iBAAiBF,YAAAA,GAAe;AAClC,sBAAMG,YAAY7B,QAAQ0B,cAAc,UAAUD,WAAAA;AAClD,sBAAI7B,WAAWiC,SAAAA,GAAY;AAEzB,oBAAKF,mBAAmBG,SAAS,GAAA,MAC/BH,sBAAsB,MAExBA,sBAAsB,UAAUH,cAChCV,IAAIG,QAAQU;AACZ;kBACF;gBACF;AAGA,oBAAMI,iBAAiBL,eAAeD;AACtC,oBAAI7B,WAAWmC,cAAAA,GAAiB;AAC9BJ,wCAAsBH,cACtBV,IAAIG,QAAQU;AACZ;gBACF;cACF;YACF;UACF;QACF;MACF;IACF;EACF;AACF;AAEA,SAASC,iBAAiBI,cAAY;AACpC,SAAOpC,WAAWoC,YAAAA,KAAiBnC,UAAUmC,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", "jsExtension", "resolvedPath", "newModuleSpecifier", "isLocalDirectory", "indexPath", "endsWith", "filePathWithJs", "absolutePath", "isDirectory"]
|
|
6
6
|
}
|
package/package.json
CHANGED
package/src/commonjs.ts
CHANGED
|
@@ -25,6 +25,7 @@ export default function fullySpecifyCommonJS(api) {
|
|
|
25
25
|
|
|
26
26
|
const fileDir = dirname(filePath)
|
|
27
27
|
const cjsExtension = '.cjs'
|
|
28
|
+
const jsExtension = '.js'
|
|
28
29
|
|
|
29
30
|
// Check if moduleSpecifier already has an extension
|
|
30
31
|
if (!extname(moduleSpecifier)) {
|
|
@@ -33,7 +34,7 @@ export default function fullySpecifyCommonJS(api) {
|
|
|
33
34
|
|
|
34
35
|
// Check if the moduleSpecifier is a directory with an index.cjs file
|
|
35
36
|
if (isLocalDirectory(resolvedPath)) {
|
|
36
|
-
const indexPath = resolve(resolvedPath, 'index' +
|
|
37
|
+
const indexPath = resolve(resolvedPath, 'index' + jsExtension)
|
|
37
38
|
if (existsSync(indexPath)) {
|
|
38
39
|
// Append '/' if not present
|
|
39
40
|
if (!newModuleSpecifier.endsWith('/')) {
|
|
@@ -46,8 +47,8 @@ export default function fullySpecifyCommonJS(api) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// Check if the moduleSpecifier.cjs file exists
|
|
49
|
-
const
|
|
50
|
-
if (existsSync(
|
|
50
|
+
const filePathWithJs = resolvedPath + jsExtension
|
|
51
|
+
if (existsSync(filePathWithJs)) {
|
|
51
52
|
newModuleSpecifier += cjsExtension
|
|
52
53
|
arg.value = newModuleSpecifier
|
|
53
54
|
return
|
package/types/commonjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../src/commonjs.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,GAAG,KAAA;;;;;
|
|
1
|
+
{"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../src/commonjs.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,GAAG,KAAA;;;;;EA2D/C"}
|