smartbundle 0.8.0-alpha.1 → 0.8.0
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/__do_not_import_directly__/tasks/buildTypesTask/callTypescript.js +3 -2
- package/__do_not_import_directly__/tasks/buildTypesTask/callTypescript.mjs +3 -2
- package/__do_not_import_directly__/writePackageJson.js +5 -5
- package/__do_not_import_directly__/writePackageJson.mjs +5 -5
- package/package.json +5 -5
- package/src/index.js +3 -3
- package/src/index.mjs +3 -3
- package/src/{writePackageJson.d.cts → writePackageJson.d.mts} +2 -2
- package/src/writePackageJson.d.ts +2 -2
- /package/src/{args.d.cts → args.d.mts} +0 -0
- /package/src/{buildVite.d.cts → buildVite.d.mts} +0 -0
- /package/src/{createViteConfig.d.cts → createViteConfig.d.mts} +0 -0
- /package/src/{error.d.cts → error.d.mts} +0 -0
- /package/src/{errors.d.cts → errors.d.mts} +0 -0
- /package/src/{index.d.cts → index.d.mts} +0 -0
- /package/src/{packageJson.d.cts → packageJson.d.mts} +0 -0
- /package/src/{resolveDirs.d.cts → resolveDirs.d.mts} +0 -0
- /package/src/{run.d.cts → run.d.mts} +0 -0
- /package/src/tasks/{binsTask.d.cts → binsTask.d.mts} +0 -0
- /package/src/tasks/buildTypesTask/{buildTypesTask.d.cts → buildTypesTask.d.mts} +0 -0
- /package/src/tasks/buildTypesTask/{callTypescript.d.cts → callTypescript.d.mts} +0 -0
- /package/src/tasks/{copyStaticFilesTask.d.cts → copyStaticFilesTask.d.mts} +0 -0
- /package/src/tasks/{jsFilesTask.d.cts → jsFilesTask.d.mts} +0 -0
- /package/src/tasks/{utils.d.cts → utils.d.mts} +0 -0
@@ -57,12 +57,13 @@ async function callTypescript({
|
|
57
57
|
const program = ts.createProgram(files, parsedCommandLine.options, host);
|
58
58
|
program.emit(void 0, (fileName, data) => {
|
59
59
|
const relativePath = path__namespace.relative(sourceDir, fileName);
|
60
|
-
const
|
60
|
+
const finalPath = path__namespace.join(outDir, relativePath);
|
61
|
+
const esmFinalPath = finalPath.replace(/\.d\.ts$/, ".d.mts");
|
61
62
|
const sourceFileName = fileName.replace(/\.d\.ts$/, ".ts");
|
62
63
|
sourceToDtsMap.set(esmFinalPath, sourceFileName);
|
63
64
|
fs__namespace.mkdirSync(path__namespace.dirname(esmFinalPath), { recursive: true });
|
64
65
|
fs__namespace.writeFileSync(esmFinalPath, data);
|
65
|
-
const cjsFinalPath =
|
66
|
+
const cjsFinalPath = finalPath.replace(/\.d\.ts$/, ".d.ts");
|
66
67
|
fs__namespace.writeFileSync(cjsFinalPath, data);
|
67
68
|
sourceToDtsMap.set(cjsFinalPath, sourceFileName);
|
68
69
|
});
|
@@ -37,12 +37,13 @@ async function callTypescript({
|
|
37
37
|
const program = ts.createProgram(files, parsedCommandLine.options, host);
|
38
38
|
program.emit(void 0, (fileName, data) => {
|
39
39
|
const relativePath = path.relative(sourceDir, fileName);
|
40
|
-
const
|
40
|
+
const finalPath = path.join(outDir, relativePath);
|
41
|
+
const esmFinalPath = finalPath.replace(/\.d\.ts$/, ".d.mts");
|
41
42
|
const sourceFileName = fileName.replace(/\.d\.ts$/, ".ts");
|
42
43
|
sourceToDtsMap.set(esmFinalPath, sourceFileName);
|
43
44
|
fs.mkdirSync(path.dirname(esmFinalPath), { recursive: true });
|
44
45
|
fs.writeFileSync(esmFinalPath, data);
|
45
|
-
const cjsFinalPath =
|
46
|
+
const cjsFinalPath = finalPath.replace(/\.d\.ts$/, ".d.ts");
|
46
47
|
fs.writeFileSync(cjsFinalPath, data);
|
47
48
|
sourceToDtsMap.set(cjsFinalPath, sourceFileName);
|
48
49
|
});
|
@@ -18,19 +18,19 @@ async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
|
18
18
|
const anExport = {};
|
19
19
|
if (value.mjs) {
|
20
20
|
anExport.import = {};
|
21
|
-
if (value.
|
22
|
-
anExport.import.types = value.
|
21
|
+
if (value.dmts) {
|
22
|
+
anExport.import.types = value.dmts;
|
23
23
|
}
|
24
24
|
anExport.import.default = value.mjs;
|
25
25
|
}
|
26
26
|
if (value.cjs) {
|
27
27
|
anExport.require = {};
|
28
|
-
if (value.
|
29
|
-
anExport.require.types = value.
|
28
|
+
if (value.dcts) {
|
29
|
+
anExport.require.types = value.dcts;
|
30
30
|
}
|
31
31
|
anExport.require.default = value.cjs;
|
32
32
|
}
|
33
|
-
anExport.types = value.
|
33
|
+
anExport.types = value.dcts ?? value.dmts;
|
34
34
|
anExport.default = value.cjs;
|
35
35
|
allExports[key] = anExport;
|
36
36
|
}
|
@@ -16,19 +16,19 @@ async function writePackageJson(outDir, parsed, { exportsMap, binsMap }) {
|
|
16
16
|
const anExport = {};
|
17
17
|
if (value.mjs) {
|
18
18
|
anExport.import = {};
|
19
|
-
if (value.
|
20
|
-
anExport.import.types = value.
|
19
|
+
if (value.dmts) {
|
20
|
+
anExport.import.types = value.dmts;
|
21
21
|
}
|
22
22
|
anExport.import.default = value.mjs;
|
23
23
|
}
|
24
24
|
if (value.cjs) {
|
25
25
|
anExport.require = {};
|
26
|
-
if (value.
|
27
|
-
anExport.require.types = value.
|
26
|
+
if (value.dcts) {
|
27
|
+
anExport.require.types = value.dcts;
|
28
28
|
}
|
29
29
|
anExport.require.default = value.cjs;
|
30
30
|
}
|
31
|
-
anExport.types = value.
|
31
|
+
anExport.types = value.dcts ?? value.dmts;
|
32
32
|
anExport.default = value.cjs;
|
33
33
|
allExports[key] = anExport;
|
34
34
|
}
|
package/package.json
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
{
|
2
2
|
"name": "smartbundle",
|
3
3
|
"type": "commonjs",
|
4
|
-
"version": "0.8.0
|
4
|
+
"version": "0.8.0",
|
5
5
|
"bin": {
|
6
6
|
"smartbundle": "__bin__/smartbundle.js"
|
7
7
|
},
|
8
|
-
"types": "./src/index.d.
|
8
|
+
"types": "./src/index.d.ts",
|
9
9
|
"module": "./src/index.mjs",
|
10
10
|
"main": "./src/index.js",
|
11
11
|
"description": "zero-config bundler for npm packages",
|
12
12
|
"exports": {
|
13
13
|
".": {
|
14
14
|
"import": {
|
15
|
-
"types": "./src/index.d.
|
15
|
+
"types": "./src/index.d.mts",
|
16
16
|
"default": "./src/index.mjs"
|
17
17
|
},
|
18
18
|
"require": {
|
19
|
-
"types": "./src/index.d.
|
19
|
+
"types": "./src/index.d.ts",
|
20
20
|
"default": "./src/index.js"
|
21
21
|
},
|
22
|
-
"types": "./src/index.d.
|
22
|
+
"types": "./src/index.d.ts",
|
23
23
|
"default": "./src/index.js"
|
24
24
|
},
|
25
25
|
"./package.json": "./package.json"
|
package/src/index.js
CHANGED
@@ -61,10 +61,10 @@ async function run(args) {
|
|
61
61
|
for (const [types, source] of res) {
|
62
62
|
setExports(exportsMap, source, (entry) => {
|
63
63
|
if (types.endsWith(".d.ts")) {
|
64
|
-
entry.
|
64
|
+
entry.dcts = "./" + path.relative(outDir, types);
|
65
65
|
}
|
66
|
-
if (types.endsWith(".d.
|
67
|
-
entry.
|
66
|
+
if (types.endsWith(".d.mts")) {
|
67
|
+
entry.dmts = "./" + path.relative(outDir, types);
|
68
68
|
}
|
69
69
|
return entry;
|
70
70
|
});
|
package/src/index.mjs
CHANGED
@@ -59,10 +59,10 @@ async function run(args) {
|
|
59
59
|
for (const [types, source] of res) {
|
60
60
|
setExports(exportsMap, source, (entry) => {
|
61
61
|
if (types.endsWith(".d.ts")) {
|
62
|
-
entry.
|
62
|
+
entry.dcts = "./" + relative(outDir, types);
|
63
63
|
}
|
64
|
-
if (types.endsWith(".d.
|
65
|
-
entry.
|
64
|
+
if (types.endsWith(".d.mts")) {
|
65
|
+
entry.dmts = "./" + relative(outDir, types);
|
66
66
|
}
|
67
67
|
return entry;
|
68
68
|
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|