@lark-apaas/fullstack-cli 1.1.63-alpha.20260826175639 → 1.1.63-alpha.20260826182714
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 +1 -1
- package/templates/scripts/dev-server.js +30 -24
package/package.json
CHANGED
|
@@ -89,9 +89,13 @@ function cleanStaleSwcOutputs(projectRoot) {
|
|
|
89
89
|
);
|
|
90
90
|
const outDir = resolveInsideProject(projectRoot, outDirName);
|
|
91
91
|
const rootDir = resolveInsideProject(projectRoot, rootDirName);
|
|
92
|
-
if (!outDir
|
|
92
|
+
if (!outDir) {
|
|
93
93
|
return 0;
|
|
94
94
|
}
|
|
95
|
+
const emitRoots = [sourceRoot];
|
|
96
|
+
if (rootDir && rootDir !== sourceRoot) {
|
|
97
|
+
emitRoots.push(rootDir);
|
|
98
|
+
}
|
|
95
99
|
|
|
96
100
|
let removed = 0;
|
|
97
101
|
const pendingDirectories = [sourceRoot];
|
|
@@ -115,35 +119,37 @@ function cleanStaleSwcOutputs(projectRoot) {
|
|
|
115
119
|
if (!sourceExtension) {
|
|
116
120
|
continue;
|
|
117
121
|
}
|
|
118
|
-
const relativeSourcePath = path.relative(rootDir, sourcePath);
|
|
119
|
-
if (
|
|
120
|
-
relativeSourcePath === '..' ||
|
|
121
|
-
relativeSourcePath.startsWith(`..${path.sep}`) ||
|
|
122
|
-
path.isAbsolute(relativeSourcePath)
|
|
123
|
-
) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
122
|
const outputExtension =
|
|
128
123
|
sourceExtension === '.mts'
|
|
129
124
|
? '.mjs'
|
|
130
125
|
: sourceExtension === '.cts'
|
|
131
126
|
? '.cjs'
|
|
132
127
|
: '.js';
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
128
|
+
for (const emitRoot of emitRoots) {
|
|
129
|
+
const relativeSourcePath = path.relative(emitRoot, sourcePath);
|
|
130
|
+
if (
|
|
131
|
+
relativeSourcePath === '..' ||
|
|
132
|
+
relativeSourcePath.startsWith(`..${path.sep}`) ||
|
|
133
|
+
path.isAbsolute(relativeSourcePath)
|
|
134
|
+
) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const outputBasePath = path.join(
|
|
139
|
+
outDir,
|
|
140
|
+
relativeSourcePath.slice(0, -sourceExtension.length)
|
|
141
|
+
);
|
|
142
|
+
for (const suffix of [
|
|
143
|
+
outputExtension,
|
|
144
|
+
`${outputExtension}.map`,
|
|
145
|
+
'.d.ts',
|
|
146
|
+
'.d.ts.map',
|
|
147
|
+
]) {
|
|
148
|
+
const outputPath = `${outputBasePath}${suffix}`;
|
|
149
|
+
if (fs.existsSync(outputPath)) {
|
|
150
|
+
fs.rmSync(outputPath, { force: true });
|
|
151
|
+
removed += 1;
|
|
152
|
+
}
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
}
|