@lark-apaas/fullstack-cli 1.1.64-alpha.20260901040718 → 1.1.64-alpha.20260901063858
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/index.js +10 -71
- package/package.json +1 -1
- package/templates/scripts/build.sh +12 -0
package/dist/index.js
CHANGED
|
@@ -1195,80 +1195,19 @@ function extractTypeAnnotation(comment) {
|
|
|
1195
1195
|
const typeStart = comment.indexOf("@type");
|
|
1196
1196
|
if (typeStart === -1) return null;
|
|
1197
1197
|
const afterType = comment.slice(typeStart + 5).trimStart();
|
|
1198
|
-
if (!afterType) return null;
|
|
1199
|
-
if (afterType.startsWith("{")) {
|
|
1200
|
-
const braceEnd = matchBalanced(afterType, 0, "{", "}");
|
|
1201
|
-
if (braceEnd === -1) return null;
|
|
1202
|
-
return afterType.slice(0, consumeArraySuffixes(afterType, braceEnd)).trimEnd();
|
|
1203
|
-
}
|
|
1204
|
-
const parsedEnd = parseTypeExpression(afterType);
|
|
1205
|
-
if (parsedEnd === -1) return null;
|
|
1206
|
-
const rest = afterType.slice(parsedEnd).replace(/^\s+/, "");
|
|
1207
|
-
if (rest && !rest.startsWith("@") && continuesTypeExpression(rest)) return null;
|
|
1208
|
-
return afterType.slice(0, parsedEnd).trimEnd();
|
|
1209
|
-
}
|
|
1210
|
-
function matchBalanced(source, start, open, close) {
|
|
1198
|
+
if (!afterType.startsWith("{")) return null;
|
|
1211
1199
|
let depth = 0;
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
if (
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
else if (source[i] === close) {
|
|
1220
|
-
depth--;
|
|
1221
|
-
if (depth === 0) return i + 1;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
return -1;
|
|
1225
|
-
}
|
|
1226
|
-
function skipStringLiteral(source, i) {
|
|
1227
|
-
const quote = source[i];
|
|
1228
|
-
if (quote !== "'" && quote !== '"' && quote !== "`") return -1;
|
|
1229
|
-
for (let j = i + 1; j < source.length; j++) {
|
|
1230
|
-
if (source[j] === "\\") {
|
|
1231
|
-
j++;
|
|
1232
|
-
continue;
|
|
1200
|
+
let endIndex = 0;
|
|
1201
|
+
for (let i = 0; i < afterType.length; i++) {
|
|
1202
|
+
if (afterType[i] === "{") depth++;
|
|
1203
|
+
if (afterType[i] === "}") depth--;
|
|
1204
|
+
if (depth === 0) {
|
|
1205
|
+
endIndex = i + 1;
|
|
1206
|
+
break;
|
|
1233
1207
|
}
|
|
1234
|
-
if (source[j] === quote) return j + 1;
|
|
1235
1208
|
}
|
|
1236
|
-
return
|
|
1237
|
-
|
|
1238
|
-
function consumeArraySuffixes(source, end) {
|
|
1239
|
-
let i = end;
|
|
1240
|
-
for (; ; ) {
|
|
1241
|
-
const suffix = /^\s*\[\s*\]/.exec(source.slice(i));
|
|
1242
|
-
if (!suffix) return i;
|
|
1243
|
-
i += suffix[0].length;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
function parseTypeExpression(source) {
|
|
1247
|
-
let i = parseTypeAtom(source, 0);
|
|
1248
|
-
if (i === -1) return -1;
|
|
1249
|
-
for (; ; ) {
|
|
1250
|
-
const union = /^\s*\|\s*/.exec(source.slice(i));
|
|
1251
|
-
if (!union) return i;
|
|
1252
|
-
const next = parseTypeAtom(source, i + union[0].length);
|
|
1253
|
-
if (next === -1) return i;
|
|
1254
|
-
i = next;
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
function parseTypeAtom(source, start) {
|
|
1258
|
-
const quoted = skipStringLiteral(source, start);
|
|
1259
|
-
if (quoted !== -1) return consumeArraySuffixes(source, quoted);
|
|
1260
|
-
const identifier = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*/.exec(source.slice(start));
|
|
1261
|
-
if (!identifier) return -1;
|
|
1262
|
-
let i = start + identifier[0].length;
|
|
1263
|
-
if (source[i] === "<") {
|
|
1264
|
-
const generic = matchBalanced(source, i, "<", ">");
|
|
1265
|
-
if (generic === -1) return i;
|
|
1266
|
-
i = generic;
|
|
1267
|
-
}
|
|
1268
|
-
return consumeArraySuffixes(source, i);
|
|
1269
|
-
}
|
|
1270
|
-
function continuesTypeExpression(rest) {
|
|
1271
|
-
return /^(?:[|&<>[\].,()?:=]|extends\b|keyof\b|typeof\b|infer\b)/.test(rest);
|
|
1209
|
+
if (endIndex === 0) return null;
|
|
1210
|
+
return afterType.slice(0, endIndex);
|
|
1272
1211
|
}
|
|
1273
1212
|
function parseColumnComment(comment) {
|
|
1274
1213
|
const typeValue = extractTypeAnnotation(comment);
|
package/package.json
CHANGED
|
@@ -154,6 +154,18 @@ if [ -d "$DIST_DIR/client" ]; then
|
|
|
154
154
|
find "$DIST_DIR/client" -maxdepth 1 -name "*.html" -exec mv {} "$DIST_DIR/dist/client/" \;
|
|
155
155
|
fi
|
|
156
156
|
|
|
157
|
+
# 拷贝 shared/static → dist/shared/static
|
|
158
|
+
# Nest server 生产从 process.cwd() + shared/static 读 (nestjs-core static.controller.ts:100),
|
|
159
|
+
# 生产 cwd = dist/, 所以目标是 dist/shared/static。coding-preset 的 static-assets plugin
|
|
160
|
+
# 之前 closeBundle 拷贝, 现在删除后交给 build.sh 显式做 (跟 jsPage 的 output_static rsync 对齐)。
|
|
161
|
+
# 排除 .ts/.tsx/.js/.jsx: 避免 shared/static/ 里若有开发脚本被误传到生产。
|
|
162
|
+
if [ -d "$ROOT_DIR/shared/static" ]; then
|
|
163
|
+
mkdir -p "$DIST_DIR/shared/static"
|
|
164
|
+
rsync -a --exclude='*.ts' --exclude='*.tsx' --exclude='*.js' --exclude='*.jsx' \
|
|
165
|
+
"$ROOT_DIR/shared/static/" "$DIST_DIR/shared/static/"
|
|
166
|
+
echo " Static → dist/shared/static/"
|
|
167
|
+
fi
|
|
168
|
+
|
|
157
169
|
# server 相关产物准备(only_frontend_change=true 时跳过)
|
|
158
170
|
if [[ "${only_frontend_change:-false}" == "true" ]]; then
|
|
159
171
|
echo " [skip] 跳过 run.sh/.env 复制 (only_frontend_change=true)"
|