uc-dev 1.0.5 → 1.0.6
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/out/cli.js +108 -108
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -58,8 +58,8 @@ function correctpath(str, trim = false) {
|
|
|
58
58
|
function subtractPath(basePath, targetPath, pathModule) {
|
|
59
59
|
const absBase = pathModule.resolve(basePath);
|
|
60
60
|
const absTarget = pathModule.resolve(targetPath);
|
|
61
|
-
const
|
|
62
|
-
return
|
|
61
|
+
const relative6 = pathModule.relative(absBase, absTarget);
|
|
62
|
+
return relative6;
|
|
63
63
|
}
|
|
64
64
|
function trimPath(pth) {
|
|
65
65
|
return pth.replace(/^\.?\/*|\/*$/g, "");
|
|
@@ -93,7 +93,7 @@ var ProjectRowBase = class {
|
|
|
93
93
|
resolvablePackages = {};
|
|
94
94
|
configGuid = "";
|
|
95
95
|
rootPath = "";
|
|
96
|
-
|
|
96
|
+
// aliceTo_Path?: { [alice: string]: string; } = {};
|
|
97
97
|
projectPrimaryAlice = "";
|
|
98
98
|
children = [];
|
|
99
99
|
config = new UserUCConfig();
|
|
@@ -715,16 +715,16 @@ var ucUtil = class _ucUtil {
|
|
|
715
715
|
};
|
|
716
716
|
|
|
717
717
|
// src/utils/cliMain.ts
|
|
718
|
-
import { existsSync as
|
|
718
|
+
import { existsSync as existsSync12, readFileSync as readFileSync7 } from "fs";
|
|
719
719
|
import path6, { join as join15 } from "path";
|
|
720
720
|
|
|
721
721
|
// src/utils/cliDependancyChecker.ts
|
|
722
722
|
import { spawn } from "node:child_process";
|
|
723
|
-
import { existsSync as
|
|
723
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
724
724
|
|
|
725
725
|
// src/utils/prompt.ts
|
|
726
|
-
import { existsSync as
|
|
727
|
-
import { dirname as dirname2, resolve as
|
|
726
|
+
import { existsSync as existsSync4, readFileSync, writeFileSync } from "node:fs";
|
|
727
|
+
import { dirname as dirname2, resolve as resolve3 } from "node:path";
|
|
728
728
|
import readline from "node:readline";
|
|
729
729
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
730
730
|
|
|
@@ -1093,8 +1093,8 @@ var ImportMapResolver = class {
|
|
|
1093
1093
|
|
|
1094
1094
|
// ../ap-shared-core/out/uc-dev/ConfigHandler.js
|
|
1095
1095
|
import { createRequire } from "module";
|
|
1096
|
-
import fs2, { readdirSync } from "node:fs";
|
|
1097
|
-
import path2, { join as join2, normalize as normalize2 } from "node:path";
|
|
1096
|
+
import fs2, { existsSync as existsSync3, readdirSync } from "node:fs";
|
|
1097
|
+
import path2, { join as join2, normalize as normalize2, relative as relative2, resolve as resolve2 } from "node:path";
|
|
1098
1098
|
import url2 from "node:url";
|
|
1099
1099
|
|
|
1100
1100
|
// ../ap-shared-core/out/uc-dev/userConfigManage.js
|
|
@@ -1185,6 +1185,7 @@ var ConfigHandler = class {
|
|
|
1185
1185
|
scopes: {}
|
|
1186
1186
|
};
|
|
1187
1187
|
MAKE_IMPORTMAP = (mainProjRow) => {
|
|
1188
|
+
debugger;
|
|
1188
1189
|
const __ImpMap = {
|
|
1189
1190
|
imports: {},
|
|
1190
1191
|
scopes: {}
|
|
@@ -1203,24 +1204,20 @@ var ConfigHandler = class {
|
|
|
1203
1204
|
p = "./";
|
|
1204
1205
|
return p;
|
|
1205
1206
|
}
|
|
1207
|
+
const _this = this;
|
|
1206
1208
|
function walk(prow) {
|
|
1207
1209
|
const aliases2 = {};
|
|
1208
1210
|
const pathAlias = prow.config?.browser?.importmap ?? {};
|
|
1209
1211
|
for (let [als, relPath] of Object.entries(pathAlias)) {
|
|
1210
1212
|
als = trimPath(als);
|
|
1211
|
-
|
|
1212
|
-
let
|
|
1213
|
-
let resolvPath = normalize2(path2.join(fpath, relPath));
|
|
1214
|
-
if (!fs2.existsSync(resolvPath)) {
|
|
1215
|
-
console.warn("ImportMap path not found:", resolvPath);
|
|
1216
|
-
continue;
|
|
1217
|
-
}
|
|
1213
|
+
let ___projectRootPath = resolve2(_this.MAIN_PROJECT_PATH, prow.rootPath);
|
|
1214
|
+
let resolvPath = normalize2(path2.join(___projectRootPath, relPath));
|
|
1218
1215
|
if (!fs2.existsSync(resolvPath)) {
|
|
1219
1216
|
console.warn("ImportMap path not found:", resolvPath);
|
|
1220
1217
|
continue;
|
|
1221
1218
|
}
|
|
1222
1219
|
const isDir = fs2.statSync(resolvPath).isDirectory();
|
|
1223
|
-
let np = correctpath(path2.relative(
|
|
1220
|
+
let np = correctpath(path2.relative(_this.MAIN_PROJECT_PATH, resolvPath));
|
|
1224
1221
|
np = cpath(np, isDir);
|
|
1225
1222
|
aliases2[isDir ? `${als}/` : `${als}`] = np;
|
|
1226
1223
|
}
|
|
@@ -1253,36 +1250,35 @@ var ConfigHandler = class {
|
|
|
1253
1250
|
this.srcDirPath = this.pref.dirDeclaration[this.pref.srcDec].dirPath;
|
|
1254
1251
|
this.outDirPath = this.pref.dirDeclaration[this.pref.outDec].dirPath;
|
|
1255
1252
|
this.allConfig.sort((a, b) => b.importMetaURL.length - a.importMetaURL.length);
|
|
1256
|
-
this.
|
|
1253
|
+
this.update_Alice_To_Path(this.allConfig);
|
|
1257
1254
|
this.importmap = this.MAKE_IMPORTMAP(this.ucConfig);
|
|
1255
|
+
console.log("done.");
|
|
1258
1256
|
for (const [k, v] of Object.entries(this.importmap.scopes)) {
|
|
1259
1257
|
if (v == void 0 || Object.keys(v).length == 0)
|
|
1260
1258
|
delete this.importmap.scopes[k];
|
|
1261
1259
|
}
|
|
1262
1260
|
ImportMapResolver.init(this.importmap, this.MAIN_PROJECT_PATH);
|
|
1263
1261
|
};
|
|
1264
|
-
|
|
1262
|
+
update_Alice_To_Path(rows) {
|
|
1265
1263
|
let mainProjectPath = this.MAIN_CONFIG.projectPath;
|
|
1266
1264
|
const dict = this.ALL_PROJECTS_DIRECTORIES;
|
|
1267
1265
|
rows.forEach((row) => {
|
|
1268
|
-
for (const [pathAliasKey, pathAliasValue] of Object.entries(row.config.browser.importmap)) {
|
|
1269
|
-
let fullPath = correctpath(path2.join(mainProjectPath, pathAliasValue) + "/");
|
|
1270
|
-
let p = rows.find((s) => fullPath.startsWith(s.projectPath));
|
|
1271
|
-
if (p != void 0)
|
|
1272
|
-
row.aliceToPath[pathAliasKey] = p.projectPath;
|
|
1273
|
-
}
|
|
1274
1266
|
const cfg = row.config;
|
|
1275
1267
|
cfg.browser = cfg.browser ?? { importmap: {}, resolveProjects: [] };
|
|
1276
1268
|
cfg.browser.importmap = cfg.browser.importmap ?? {};
|
|
1277
1269
|
const imap = cfg.browser.importmap;
|
|
1278
1270
|
});
|
|
1279
1271
|
}
|
|
1272
|
+
addedProject = {};
|
|
1280
1273
|
async RecurciveFindConfigAndFill(projectDirPath, row) {
|
|
1274
|
+
const _this = this;
|
|
1281
1275
|
if (projectDirPath != void 0) {
|
|
1282
|
-
projectDirPath = path2.normalize(projectDirPath);
|
|
1283
1276
|
if (this.allConfig.findIndex((s) => isSamePath2(s.projectPath, projectDirPath)) >= 0)
|
|
1284
1277
|
return;
|
|
1285
1278
|
let projectName = GetProjectName(projectDirPath, path2, fs2);
|
|
1279
|
+
if (this.allConfig.findIndex((s) => s.projectName == projectName) >= 0)
|
|
1280
|
+
return;
|
|
1281
|
+
projectDirPath = path2.normalize(projectDirPath);
|
|
1286
1282
|
const ucConfigPath = path2.join(projectDirPath, "ucconfig.js");
|
|
1287
1283
|
if (fs2.existsSync(ucConfigPath)) {
|
|
1288
1284
|
let ucCfg = await ImportUserConfig(ucConfigPath);
|
|
@@ -1296,12 +1292,8 @@ var ConfigHandler = class {
|
|
|
1296
1292
|
row.projectPath = correctpath(projectDirPath);
|
|
1297
1293
|
const cfg = row.config;
|
|
1298
1294
|
this.ALL_PROJECTS_DIRECTORIES[row.projectName] = this.ALL_PROJECTS_DIRECTORIES[row.projectName] ?? row.projectPath;
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
row.projectPath
|
|
1302
|
-
/*join(row.projectPath, outdec.dirPath)*/
|
|
1303
|
-
)));
|
|
1304
|
-
row.rootPath = row.rootPath == "." ? "." : path2.join("./", row.rootPath, "/");
|
|
1295
|
+
const _rpath = correctpath(normalize2(relative2(this.MAIN_PROJECT_PATH, row.projectPath)));
|
|
1296
|
+
row.rootPath = _rpath == "." ? "." : path2.join("./", _rpath, "/");
|
|
1305
1297
|
cfg.browser = cfg.browser ?? new BrowserUcConfig();
|
|
1306
1298
|
cfg.browser.importmap = cfg.browser.importmap ?? {};
|
|
1307
1299
|
const pref = cfg.preference;
|
|
@@ -1310,15 +1302,20 @@ var ConfigHandler = class {
|
|
|
1310
1302
|
row.importMetaURL = url2.pathToFileURL(projectDirPath).href;
|
|
1311
1303
|
let dirs = this.listProjectPath(projectDirPath);
|
|
1312
1304
|
row.resolvablePackages = this.PACKAGE_LIST;
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1305
|
+
const browser = row.config.browser;
|
|
1306
|
+
for (const [k, pkg] of Object.entries(row.resolvablePackages)) {
|
|
1307
|
+
const als = aliceFromExternalProject(pkg, this.MAIN_PROJECT_PATH);
|
|
1308
|
+
Object.assign(browser.importmap, als);
|
|
1316
1309
|
}
|
|
1317
1310
|
for (let i = 0, ilen = dirs.length; i < ilen; i++) {
|
|
1318
1311
|
const child_project_dir = dirs[i];
|
|
1319
1312
|
let nchild = new ProjectRowBase();
|
|
1313
|
+
const chld = row.children;
|
|
1314
|
+
chld.push(nchild);
|
|
1320
1315
|
await this.RecurciveFindConfigAndFill(child_project_dir, nchild);
|
|
1321
|
-
|
|
1316
|
+
if (!existsSync3(nchild.projectPath)) {
|
|
1317
|
+
row.children = chld.filter((s) => s !== nchild);
|
|
1318
|
+
}
|
|
1322
1319
|
}
|
|
1323
1320
|
}
|
|
1324
1321
|
} else {
|
|
@@ -1387,10 +1384,10 @@ function ask(question, def) {
|
|
|
1387
1384
|
output: process.stdout
|
|
1388
1385
|
});
|
|
1389
1386
|
const hint = def ? ` (${def})` : "";
|
|
1390
|
-
return new Promise((
|
|
1387
|
+
return new Promise((resolve13) => {
|
|
1391
1388
|
rl.question(`${question}${hint}: `, (ans) => {
|
|
1392
1389
|
rl.close();
|
|
1393
|
-
|
|
1390
|
+
resolve13(ans.trim() || def || "");
|
|
1394
1391
|
});
|
|
1395
1392
|
});
|
|
1396
1393
|
}
|
|
@@ -1402,14 +1399,14 @@ async function askYesNo(question, def = true, autoYes = false) {
|
|
|
1402
1399
|
return ans.startsWith("y");
|
|
1403
1400
|
}
|
|
1404
1401
|
function runTemplate(tptPath, importmeta, row) {
|
|
1405
|
-
const tpath =
|
|
1402
|
+
const tpath = resolve3(dirname2(fileURLToPath4(importmeta)), tptPath);
|
|
1406
1403
|
let tptContent = readFileSync(tpath, "utf8");
|
|
1407
1404
|
const tmaker = new TemplateMaker();
|
|
1408
1405
|
const callback = tmaker.compileTemplate(tptContent);
|
|
1409
1406
|
return callback(row);
|
|
1410
1407
|
}
|
|
1411
1408
|
async function writeFileSafely(fpath, data, options) {
|
|
1412
|
-
if (
|
|
1409
|
+
if (existsSync4(fpath)) {
|
|
1413
1410
|
options = JSON.parse(JSON.stringify(options));
|
|
1414
1411
|
const overwrite = options.force ?? await askYesNo(
|
|
1415
1412
|
`${fpath} already exists. Overwrite?`,
|
|
@@ -1449,8 +1446,8 @@ var cliDependancyChecker = class {
|
|
|
1449
1446
|
return _deps;
|
|
1450
1447
|
}
|
|
1451
1448
|
detectPackageManager() {
|
|
1452
|
-
if (
|
|
1453
|
-
if (
|
|
1449
|
+
if (existsSync5("pnpm-lock.yaml")) return "pnpm add ";
|
|
1450
|
+
if (existsSync5("yarn.lock")) return "yarn add ";
|
|
1454
1451
|
return "npm install ";
|
|
1455
1452
|
}
|
|
1456
1453
|
installPackages(pkgs) {
|
|
@@ -1458,13 +1455,13 @@ var cliDependancyChecker = class {
|
|
|
1458
1455
|
const args2 = [...baseArgs, ...pkgs];
|
|
1459
1456
|
console.log("Installing:", pkgs.join(", "));
|
|
1460
1457
|
console.log(">", pm, args2.join(" "));
|
|
1461
|
-
return new Promise((
|
|
1458
|
+
return new Promise((resolve13, reject) => {
|
|
1462
1459
|
const child = spawn(pm, args2, {
|
|
1463
1460
|
stdio: "inherit",
|
|
1464
1461
|
shell: true
|
|
1465
1462
|
});
|
|
1466
1463
|
child.on("close", (code) => {
|
|
1467
|
-
if (code === 0)
|
|
1464
|
+
if (code === 0) resolve13();
|
|
1468
1465
|
else reject(new Error(`Install failed with code ${code}`));
|
|
1469
1466
|
});
|
|
1470
1467
|
child.on("error", reject);
|
|
@@ -1497,14 +1494,14 @@ var cliDependancyChecker = class {
|
|
|
1497
1494
|
};
|
|
1498
1495
|
|
|
1499
1496
|
// src/utils/cliFindProjects.ts
|
|
1500
|
-
import { existsSync as
|
|
1497
|
+
import { existsSync as existsSync6, realpathSync, statSync } from "fs";
|
|
1501
1498
|
import path3 from "path";
|
|
1502
1499
|
function getProjectDir(startPath) {
|
|
1503
1500
|
let dir = statSync(startPath).isFile() ? path3.dirname(startPath) : startPath;
|
|
1504
1501
|
dir = realpathSync(dir);
|
|
1505
1502
|
while (true) {
|
|
1506
1503
|
const candidate = path3.join(dir, "package.json");
|
|
1507
|
-
if (
|
|
1504
|
+
if (existsSync6(candidate)) {
|
|
1508
1505
|
return dir;
|
|
1509
1506
|
}
|
|
1510
1507
|
const parent = path3.dirname(dir);
|
|
@@ -1516,15 +1513,15 @@ function getProjectDir(startPath) {
|
|
|
1516
1513
|
}
|
|
1517
1514
|
|
|
1518
1515
|
// src/utils/inquiry/cliUcconfigInquiry.ts
|
|
1519
|
-
import { existsSync as
|
|
1520
|
-
import { dirname as dirname3, join as join3, resolve as
|
|
1516
|
+
import { existsSync as existsSync7, readFileSync as readFileSync2 } from "node:fs";
|
|
1517
|
+
import { dirname as dirname3, join as join3, resolve as resolve4 } from "node:path";
|
|
1521
1518
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
1522
1519
|
var cliUcconfigInquiry = class {
|
|
1523
1520
|
constructor(main2) {
|
|
1524
1521
|
this.main = main2;
|
|
1525
1522
|
}
|
|
1526
1523
|
get exist() {
|
|
1527
|
-
return
|
|
1524
|
+
return existsSync7(this.configFilepath);
|
|
1528
1525
|
}
|
|
1529
1526
|
async read() {
|
|
1530
1527
|
this.main.config = await ImportUserConfig(this.configFilepath);
|
|
@@ -1533,7 +1530,7 @@ var cliUcconfigInquiry = class {
|
|
|
1533
1530
|
return join3(this.main.projectDir, "ucconfig.js");
|
|
1534
1531
|
}
|
|
1535
1532
|
inferConfigFromKnownFiles() {
|
|
1536
|
-
if (
|
|
1533
|
+
if (existsSync7("tsconfig.json")) {
|
|
1537
1534
|
const ts = JSON.parse(readFileSync2("tsconfig.json", "utf-8"));
|
|
1538
1535
|
return {
|
|
1539
1536
|
srcDir: ts.compilerOptions?.rootDir ?? "src",
|
|
@@ -1603,7 +1600,7 @@ var cliUcconfigInquiry = class {
|
|
|
1603
1600
|
};
|
|
1604
1601
|
try {
|
|
1605
1602
|
await writeFileSafely(
|
|
1606
|
-
|
|
1603
|
+
resolve4("ucconfig.js"),
|
|
1607
1604
|
_runTemplate("templates/js.ucconfig", JSON.parse(JSON.stringify(cfg))),
|
|
1608
1605
|
this.main.cliOptions
|
|
1609
1606
|
);
|
|
@@ -1808,17 +1805,17 @@ function splitCSSById(cssContent, rtrn) {
|
|
|
1808
1805
|
}
|
|
1809
1806
|
|
|
1810
1807
|
// src/lib/processes/BuildDesigner.ts
|
|
1811
|
-
import { existsSync as
|
|
1812
|
-
import { join as join6, normalize as normalize5, relative as
|
|
1808
|
+
import { existsSync as existsSync10, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
1809
|
+
import { join as join6, normalize as normalize5, relative as relative3, resolve as resolve7 } from "path";
|
|
1813
1810
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
1814
1811
|
|
|
1815
1812
|
// src/lib/processes/commonGeneratorX.ts
|
|
1816
|
-
import { existsSync as
|
|
1817
|
-
import { dirname as dirname5, join as join5, normalize as normalize4, resolve as
|
|
1813
|
+
import { existsSync as existsSync9, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
1814
|
+
import { dirname as dirname5, join as join5, normalize as normalize4, resolve as resolve6 } from "path";
|
|
1818
1815
|
|
|
1819
1816
|
// src/lib/processes/ResourceBuildEngine.ts
|
|
1820
|
-
import { existsSync as
|
|
1821
|
-
import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as
|
|
1817
|
+
import { existsSync as existsSync8, readFileSync as readFileSync3 } from "fs";
|
|
1818
|
+
import { dirname as dirname4, extname, join as join4, normalize as normalize3, resolve as resolve5, sep } from "path";
|
|
1822
1819
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
1823
1820
|
var SCSS_IMPORT_RE = /@(use|import)\s+(?:url\()?["']([^"')]+)["']\)?\s*;/gi;
|
|
1824
1821
|
var CSS_URL_RE = /url\(\s*["']?([^"')]+)["']?\s*\)/gi;
|
|
@@ -1923,7 +1920,7 @@ var ResourceBuildEngine = class {
|
|
|
1923
1920
|
if (_path.startsWith("file:///")) _path = fileURLToPath6(_path);
|
|
1924
1921
|
const absPath = (
|
|
1925
1922
|
/*GetProject(path)*/
|
|
1926
|
-
|
|
1923
|
+
resolve5(_path)
|
|
1927
1924
|
);
|
|
1928
1925
|
const blueprint = new UserResource();
|
|
1929
1926
|
Object.assign(blueprint, _blueprint);
|
|
@@ -1936,7 +1933,7 @@ var ResourceBuildEngine = class {
|
|
|
1936
1933
|
}
|
|
1937
1934
|
return ResourceKeyBridge.makeKey(res.guid);
|
|
1938
1935
|
}
|
|
1939
|
-
if (!
|
|
1936
|
+
if (!existsSync8(absPath)) {
|
|
1940
1937
|
console.log("Missing resource:", absPath);
|
|
1941
1938
|
return void 0;
|
|
1942
1939
|
}
|
|
@@ -1984,7 +1981,7 @@ var ResourceBuildEngine = class {
|
|
|
1984
1981
|
css = stripCssComments(css);
|
|
1985
1982
|
css = ucUtil.devEsc(css);
|
|
1986
1983
|
css = css.replace(INSIDE_ATTR_RE, (_m, _q, rel, rest) => {
|
|
1987
|
-
const targetAbs =
|
|
1984
|
+
const targetAbs = resolve5(dirname4(absPath), rel);
|
|
1988
1985
|
const key = this.build(targetAbs);
|
|
1989
1986
|
return key ? `[inside="${key}"]${rest}` : _m;
|
|
1990
1987
|
});
|
|
@@ -2061,8 +2058,8 @@ var ResourceBuildEngine = class {
|
|
|
2061
2058
|
this.resourceMap.set(rel, res);
|
|
2062
2059
|
return ResourceKeyBridge.makeKey(guid);
|
|
2063
2060
|
}
|
|
2064
|
-
const abs =
|
|
2065
|
-
if (!
|
|
2061
|
+
const abs = resolve5(dirname4(importerPath), rel);
|
|
2062
|
+
if (!existsSync8(abs)) return rel;
|
|
2066
2063
|
return this.build(abs, _blueprint);
|
|
2067
2064
|
}
|
|
2068
2065
|
};
|
|
@@ -2148,11 +2145,11 @@ var commonGeneratorX = class _commonGeneratorX {
|
|
|
2148
2145
|
ensureDirectoryExistence(row.src.pathOf[designerFileSrctype]);
|
|
2149
2146
|
_data = this.filex(`${srctype}${uctype}.designer`)(row);
|
|
2150
2147
|
writeFileSync2(row.src.pathOf[designerFileSrctype], _data);
|
|
2151
|
-
if (!
|
|
2148
|
+
if (!existsSync9(row.src.pathOf[codeFileSrctype])) {
|
|
2152
2149
|
_data = this.filex(`${srctype}${uctype}.code`)(row);
|
|
2153
2150
|
writeFileSync2(row.src.pathOf[codeFileSrctype], _data);
|
|
2154
2151
|
}
|
|
2155
|
-
if (!
|
|
2152
|
+
if (!existsSync9(row.src.pathOf.scss)) {
|
|
2156
2153
|
_data = this.filex(`${srctype}${uctype}.style`)(row);
|
|
2157
2154
|
writeFileSync2(row.src.pathOf.scss, _data);
|
|
2158
2155
|
}
|
|
@@ -2185,13 +2182,15 @@ var commonGeneratorX = class _commonGeneratorX {
|
|
|
2185
2182
|
declareClassPath: BuildingProcess.configHandler.MAIN_CONFIG.projectName == "uc-runtime" ? "uc-runtime/src/core-main" : "uc-runtime/core-main"
|
|
2186
2183
|
};
|
|
2187
2184
|
const srcDec = x.srcDec;
|
|
2188
|
-
|
|
2185
|
+
debugger;
|
|
2186
|
+
let resSrcFile = resolve6(proj.projectPath, x.srcDec.dirPath, x.cli.ResourceStorageFile);
|
|
2189
2187
|
rowForRes.projectList.forEach((s) => {
|
|
2190
2188
|
const resFullpath = s.resourceRelativePath;
|
|
2191
2189
|
s.resourceRelativePath = JSON.stringify(resFullpath);
|
|
2192
2190
|
const y = extractPathConfig(s.project.config);
|
|
2193
|
-
|
|
2194
|
-
|
|
2191
|
+
let resFpath = join5(s.project.projectPath, y.outDec.dirPath, y.cli.ResourceStorageFile);
|
|
2192
|
+
resFpath = ucUtil.changeExtension(resFpath, ".ts", ".js");
|
|
2193
|
+
s.importResource = s.projectGuid != chandler.MAIN_CONFIG.config.guid && existsSync9(resFpath);
|
|
2195
2194
|
});
|
|
2196
2195
|
ensureDirectoryExistence(resSrcFile);
|
|
2197
2196
|
let resContent = this.filex("ts.resources")(rowForRes);
|
|
@@ -5437,10 +5436,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
5437
5436
|
function uniqueSort(nodes) {
|
|
5438
5437
|
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
|
5439
5438
|
nodes.sort((a, b) => {
|
|
5440
|
-
const
|
|
5441
|
-
if (
|
|
5439
|
+
const relative6 = compareDocumentPosition(a, b);
|
|
5440
|
+
if (relative6 & DocumentPosition.PRECEDING) {
|
|
5442
5441
|
return -1;
|
|
5443
|
-
} else if (
|
|
5442
|
+
} else if (relative6 & DocumentPosition.FOLLOWING) {
|
|
5444
5443
|
return 1;
|
|
5445
5444
|
}
|
|
5446
5445
|
return 0;
|
|
@@ -7330,7 +7329,7 @@ var BuildDesigner = class {
|
|
|
7330
7329
|
</UCWINFRAME>
|
|
7331
7330
|
</WRAPPER>`;
|
|
7332
7331
|
}
|
|
7333
|
-
if (!
|
|
7332
|
+
if (!existsSync10(finfo.allPathOf[pref.srcDec].scss)) {
|
|
7334
7333
|
writeFileSync3(finfo.allPathOf[pref.srcDec].scss, `&{
|
|
7335
7334
|
position: relative;
|
|
7336
7335
|
display:block; width: 800px; height: 500px;
|
|
@@ -7355,7 +7354,7 @@ var BuildDesigner = class {
|
|
|
7355
7354
|
const imppath = _row.src?.projectInfo.projectName == "uc-runtime" ? relativeFilePath(_row.src.allPathOf.out.designer, join6(_row.src.projectInfo.projectPath, "out/core.js")) : "uc-runtime/core.js";
|
|
7356
7355
|
_importer.addImport(["Usercontrol", "intenseGenerator", "IUcOptions", "ResourceManage"], imppath);
|
|
7357
7356
|
this.common2(row.designer, finfo);
|
|
7358
|
-
const _exists =
|
|
7357
|
+
const _exists = existsSync10;
|
|
7359
7358
|
for (let i = 0, iObj = elements, len = iObj.length; i < len; i++) {
|
|
7360
7359
|
const element = iObj[i];
|
|
7361
7360
|
onSelect_xName(element, _row);
|
|
@@ -7396,12 +7395,12 @@ var BuildDesigner = class {
|
|
|
7396
7395
|
const srcPathof = _row.src.allPathOf[pref.srcDec];
|
|
7397
7396
|
const outPathof = _row.src.allPathOf[pref.outDec];
|
|
7398
7397
|
let onSelect_xName = BuildingProcess.Event.onSelect_xName;
|
|
7399
|
-
let projectPath =
|
|
7398
|
+
let projectPath = resolve7();
|
|
7400
7399
|
let htmlcode = this.common0(_row);
|
|
7401
7400
|
if (htmlcode == void 0) return void 0;
|
|
7402
7401
|
htmlcode = ucUtil.devEsc(htmlcode);
|
|
7403
7402
|
let compileedCode = ucUtil.PHP_REMOVE(htmlcode);
|
|
7404
|
-
let rootpath =
|
|
7403
|
+
let rootpath = relative3(projectPath, srcPathof.html);
|
|
7405
7404
|
try {
|
|
7406
7405
|
if (compileedCode.trim() != "") {
|
|
7407
7406
|
compileedCode = ucUtil.PHP_REMOVE(htmlcode);
|
|
@@ -7420,7 +7419,7 @@ var BuildDesigner = class {
|
|
|
7420
7419
|
);
|
|
7421
7420
|
this.common2(row.designer, finfo);
|
|
7422
7421
|
let cssContent = "";
|
|
7423
|
-
if (
|
|
7422
|
+
if (existsSync10(srcPathof.scss)) cssContent = this.gen.cssBulder.treeShakeCss(srcPathof.scss);
|
|
7424
7423
|
let cnt = {
|
|
7425
7424
|
htmlGuid: ResourceKeyBridge.extractKey(this.gen.cssBulder.build(srcPathof.html, { source: srcPathof.html })),
|
|
7426
7425
|
cssGuid: ResourceKeyBridge.extractKey(this.gen.cssBulder.build(srcPathof.scss, { source: srcPathof.scss }))
|
|
@@ -7507,14 +7506,14 @@ var BuildDesigner = class {
|
|
|
7507
7506
|
}
|
|
7508
7507
|
};
|
|
7509
7508
|
nc(_path, fromFilePath) {
|
|
7510
|
-
let fpath = join6(
|
|
7509
|
+
let fpath = join6(resolve7(), _path);
|
|
7511
7510
|
return correctpath(ucUtil.resolveSubNode(relativeFilePath(fromFilePath, fpath)));
|
|
7512
7511
|
}
|
|
7513
7512
|
};
|
|
7514
7513
|
|
|
7515
7514
|
// src/lib/processes/ResourceCopy.ts
|
|
7516
7515
|
import { copyFileSync } from "fs";
|
|
7517
|
-
import { join as join7, relative as
|
|
7516
|
+
import { join as join7, relative as relative4 } from "path";
|
|
7518
7517
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
7519
7518
|
var ResourceCopy = class {
|
|
7520
7519
|
sourceFileList = [];
|
|
@@ -7561,7 +7560,7 @@ var ResourceCopy = class {
|
|
|
7561
7560
|
(s) => s.startsWith(dirDecfullPath) && res.includeExtensions.findIndex((e) => s.endsWith(e)) >= 0
|
|
7562
7561
|
);
|
|
7563
7562
|
filteed.forEach((full) => {
|
|
7564
|
-
const commonPath =
|
|
7563
|
+
const commonPath = relative4(dirDecfullPath, full);
|
|
7565
7564
|
res.toDeclares.forEach((todeclare) => {
|
|
7566
7565
|
let targetDir = dirDeclaration[todeclare].dirPath;
|
|
7567
7566
|
const dest = join7(targetDir, commonPath);
|
|
@@ -7794,7 +7793,7 @@ var cliMenuSource = class {
|
|
|
7794
7793
|
};
|
|
7795
7794
|
|
|
7796
7795
|
// src/utils/inquiry/cliElectronInquiry.ts
|
|
7797
|
-
import { dirname as dirname6, join as join9, resolve as
|
|
7796
|
+
import { dirname as dirname6, join as join9, resolve as resolve8 } from "node:path";
|
|
7798
7797
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
7799
7798
|
var cliElectronInquiry = class {
|
|
7800
7799
|
constructor(main2) {
|
|
@@ -7803,13 +7802,13 @@ var cliElectronInquiry = class {
|
|
|
7803
7802
|
async generate(hasAddedSampleForm = false) {
|
|
7804
7803
|
const cfg = this.main.config;
|
|
7805
7804
|
const cli = cfg.cli;
|
|
7806
|
-
const mainFilePath =
|
|
7807
|
-
const preloadFilePath =
|
|
7808
|
-
const baseHtmlPath =
|
|
7809
|
-
const baseCodePath =
|
|
7810
|
-
const baseCodeOutPath =
|
|
7811
|
-
const ResourceStorageFile =
|
|
7812
|
-
const baseCssPath =
|
|
7805
|
+
const mainFilePath = resolve8(join9(cli.srcDir, cli.mainProcessFilePath));
|
|
7806
|
+
const preloadFilePath = resolve8(join9(cli.srcDir, cli.preloadScriptFilePath));
|
|
7807
|
+
const baseHtmlPath = resolve8(cli.baseHtmlPath);
|
|
7808
|
+
const baseCodePath = resolve8(join9(cli.srcDir, cli.baseCodePath));
|
|
7809
|
+
const baseCodeOutPath = resolve8(join9(cli.outDir, cli.baseCodePath));
|
|
7810
|
+
const ResourceStorageFile = resolve8(join9(cli.srcDir, cli.ResourceStorageFile));
|
|
7811
|
+
const baseCssPath = resolve8(cli.baseCssPath);
|
|
7813
7812
|
writeFileSafely(
|
|
7814
7813
|
mainFilePath,
|
|
7815
7814
|
_runTemplate2("templates/electron/ts.main", {
|
|
@@ -7870,14 +7869,14 @@ function _runTemplate2(rel, options) {
|
|
|
7870
7869
|
}
|
|
7871
7870
|
|
|
7872
7871
|
// src/utils/inquiry/cliNewStartInquiry.ts
|
|
7873
|
-
import { dirname as dirname7, join as join10, resolve as
|
|
7872
|
+
import { dirname as dirname7, join as join10, resolve as resolve9 } from "node:path";
|
|
7874
7873
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
7875
7874
|
var cliNewStartInquiry = class {
|
|
7876
7875
|
constructor(main2) {
|
|
7877
7876
|
this.main = main2;
|
|
7878
7877
|
}
|
|
7879
7878
|
async inquiry() {
|
|
7880
|
-
const cfg = await ImportUserConfig(
|
|
7879
|
+
const cfg = await ImportUserConfig(resolve9("ucconfig.js"));
|
|
7881
7880
|
if (await askYesNo(`
|
|
7882
7881
|
+-----------------------------+
|
|
7883
7882
|
| EMPTY PROJECT |
|
|
@@ -7893,12 +7892,12 @@ ADD BLANK FORM?
|
|
|
7893
7892
|
let ddirdpath = await ask(`WHERE TO GENERATE?
|
|
7894
7893
|
INSIDE ('${renderDirPath}' DIRECTORY)
|
|
7895
7894
|
>`, "");
|
|
7896
|
-
__dpath = join10(
|
|
7895
|
+
__dpath = join10(resolve9(renderDirPath), ddirdpath);
|
|
7897
7896
|
} else {
|
|
7898
7897
|
let dirPath = await ask(`WHERE TO GENERATE?
|
|
7899
7898
|
INSIDE ('${srcdec.dirPath}' DIRECTORY)
|
|
7900
7899
|
>`, "");
|
|
7901
|
-
__dpath = join10(
|
|
7900
|
+
__dpath = join10(resolve9(srcdec.dirPath), dirPath);
|
|
7902
7901
|
}
|
|
7903
7902
|
writeFileSafely(
|
|
7904
7903
|
join10(__dpath, "form1.uc.html"),
|
|
@@ -7918,8 +7917,8 @@ function _runTemplate3(rel, options) {
|
|
|
7918
7917
|
}
|
|
7919
7918
|
|
|
7920
7919
|
// src/utils/inquiry/cliTypeScriptInquiry.ts
|
|
7921
|
-
import { existsSync as
|
|
7922
|
-
import { dirname as dirname8, join as join11, resolve as
|
|
7920
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
7921
|
+
import { dirname as dirname8, join as join11, resolve as resolve10 } from "node:path";
|
|
7923
7922
|
var cliTypeScriptInquiry = class {
|
|
7924
7923
|
constructor(main2) {
|
|
7925
7924
|
this.main = main2;
|
|
@@ -7930,7 +7929,7 @@ var cliTypeScriptInquiry = class {
|
|
|
7930
7929
|
}
|
|
7931
7930
|
async inquiry() {
|
|
7932
7931
|
const x = extractPathConfig(this.main.config);
|
|
7933
|
-
if (x.cli.useTypeScript && !
|
|
7932
|
+
if (x.cli.useTypeScript && !existsSync11(resolve10("tsconfig.json"))) {
|
|
7934
7933
|
if (await askYesNo(
|
|
7935
7934
|
`
|
|
7936
7935
|
ADD 'tsconfig.json' with required settings?
|
|
@@ -8019,11 +8018,11 @@ async function makeMenu(title, content, defaultOpt) {
|
|
|
8019
8018
|
}
|
|
8020
8019
|
|
|
8021
8020
|
// src/utils/inquiry/cli_menu_generate.ts
|
|
8022
|
-
import { dirname as dirname11, join as join14, resolve as
|
|
8021
|
+
import { dirname as dirname11, join as join14, resolve as resolve12 } from "node:path";
|
|
8023
8022
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
8024
8023
|
|
|
8025
8024
|
// src/utils/inquiry/cli_sample_style1.ts
|
|
8026
|
-
import { dirname as dirname10, join as join13, relative as
|
|
8025
|
+
import { dirname as dirname10, join as join13, relative as relative5, resolve as resolve11 } from "node:path";
|
|
8027
8026
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
8028
8027
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
8029
8028
|
async function cli_sample_style1(main2) {
|
|
@@ -8031,18 +8030,18 @@ async function cli_sample_style1(main2) {
|
|
|
8031
8030
|
const sampleroot = dirname10(join13(cli.srcDir, cli.baseCodePath));
|
|
8032
8031
|
const sample = {
|
|
8033
8032
|
frmDashboard: {
|
|
8034
|
-
html:
|
|
8035
|
-
scss:
|
|
8036
|
-
code:
|
|
8033
|
+
html: resolve11(join13(sampleroot, "frmDashboard.uc.html")),
|
|
8034
|
+
scss: resolve11(join13(sampleroot, "frmDashboard.uc.scss")),
|
|
8035
|
+
code: resolve11(join13(sampleroot, "frmDashboard.uc.ts"))
|
|
8037
8036
|
},
|
|
8038
8037
|
tptDashboard: {
|
|
8039
|
-
html:
|
|
8040
|
-
scss:
|
|
8041
|
-
code:
|
|
8038
|
+
html: resolve11(join13(sampleroot, "tptDashboard.tpt.html")),
|
|
8039
|
+
scss: resolve11(join13(sampleroot, "tptDashboard.tpt.scss")),
|
|
8040
|
+
code: resolve11(join13(sampleroot, "tptDashboard.tpt.ts"))
|
|
8042
8041
|
}
|
|
8043
8042
|
};
|
|
8044
|
-
const relHtmlPath =
|
|
8045
|
-
const designerRoot = ucUtil.changeExtension(
|
|
8043
|
+
const relHtmlPath = relative5(resolve11(cli.srcDir), sample.frmDashboard.html);
|
|
8044
|
+
const designerRoot = ucUtil.changeExtension(resolve11(join13(cli.srcDir, cli.designerDir, relHtmlPath)), ".html", ".designer.js");
|
|
8046
8045
|
const templateRoot = "templates/sample1";
|
|
8047
8046
|
await writeFileSafely(
|
|
8048
8047
|
sample.frmDashboard.html,
|
|
@@ -8054,7 +8053,7 @@ async function cli_sample_style1(main2) {
|
|
|
8054
8053
|
_runTemplate_x(`${templateRoot}/frmDashboard.uc.scss.tp`, {}),
|
|
8055
8054
|
main2.cliOptions
|
|
8056
8055
|
);
|
|
8057
|
-
const designerReletivePath =
|
|
8056
|
+
const designerReletivePath = relative5(dirname10(sample.frmDashboard.code), designerRoot);
|
|
8058
8057
|
await writeFileSafely(
|
|
8059
8058
|
sample.frmDashboard.code,
|
|
8060
8059
|
_runTemplate4(`${templateRoot}/frmDashboard.uc.ts.tp`, {
|
|
@@ -8121,7 +8120,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
|
|
|
8121
8120
|
case "t":
|
|
8122
8121
|
const cli = main2.config.cli;
|
|
8123
8122
|
await writeFileSafely(
|
|
8124
|
-
|
|
8123
|
+
resolve12("tsconfig.json"),
|
|
8125
8124
|
_runTemplate5("templates/typescript/json.tsconfig", {
|
|
8126
8125
|
outDir: main2.config.cli.outDir,
|
|
8127
8126
|
srcDir: main2.config.cli.srcDir,
|
|
@@ -8133,7 +8132,7 @@ async function cli_menu_generate(main2, back_menu_callback = async () => {
|
|
|
8133
8132
|
break;
|
|
8134
8133
|
case "v":
|
|
8135
8134
|
await writeFileSafely(
|
|
8136
|
-
|
|
8135
|
+
resolve12(".vscode/settings.json"),
|
|
8137
8136
|
_runTemplate5("templates/.vscode/json.settings", {}),
|
|
8138
8137
|
main2.cliOptions
|
|
8139
8138
|
);
|
|
@@ -8241,7 +8240,7 @@ var cliMain = class {
|
|
|
8241
8240
|
readConfig = async () => {
|
|
8242
8241
|
try {
|
|
8243
8242
|
const cfgPath = join15(this.projectDir, "ucconfig.js");
|
|
8244
|
-
if (
|
|
8243
|
+
if (existsSync12(cfgPath)) {
|
|
8245
8244
|
this.config = await ImportUserConfig(cfgPath);
|
|
8246
8245
|
if (this.config != void 0) {
|
|
8247
8246
|
const x = extractPathConfig(this.config);
|
|
@@ -8357,7 +8356,7 @@ Sub Directory Path (inside source directory) : `, fdec.subDirPath ?? "");
|
|
|
8357
8356
|
}
|
|
8358
8357
|
listProjectDependencies() {
|
|
8359
8358
|
const pkgPath = path6.resolve(this.projectDir, "package.json");
|
|
8360
|
-
if (!
|
|
8359
|
+
if (!existsSync12(pkgPath)) {
|
|
8361
8360
|
throw new Error("package.json not found in project directory");
|
|
8362
8361
|
}
|
|
8363
8362
|
const pkgJson = JSON.parse(
|
|
@@ -8388,6 +8387,7 @@ var copt = main.cliOptions;
|
|
|
8388
8387
|
copt.force = args.includes("--force");
|
|
8389
8388
|
copt.yes = args.includes("--yes");
|
|
8390
8389
|
var ignreq = args.includes("--ignreq");
|
|
8390
|
+
debugger;
|
|
8391
8391
|
switch (cmd) {
|
|
8392
8392
|
case "build":
|
|
8393
8393
|
if (!ignreq)
|