@ethisyscore/vite-plugin 1.36.0 → 1.38.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/dist/index.cjs +28 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1229,7 +1229,7 @@ function computePlatformReactPages(input) {
|
|
|
1229
1229
|
);
|
|
1230
1230
|
const entries = [];
|
|
1231
1231
|
const missingViews = [];
|
|
1232
|
-
for (const { file, content } of input.pages) {
|
|
1232
|
+
for (const { file, content, moduleSpecifier } of input.pages) {
|
|
1233
1233
|
const name = path.basename(file, ".tsx");
|
|
1234
1234
|
const override = input.pageOverrides?.[file] ?? {};
|
|
1235
1235
|
const views = {};
|
|
@@ -1247,7 +1247,7 @@ function computePlatformReactPages(input) {
|
|
|
1247
1247
|
const route = override.route ?? pageRouteById[id];
|
|
1248
1248
|
entries.push({
|
|
1249
1249
|
id,
|
|
1250
|
-
moduleSpecifier
|
|
1250
|
+
moduleSpecifier,
|
|
1251
1251
|
exportName: "default",
|
|
1252
1252
|
...route !== void 0 ? { route } : {},
|
|
1253
1253
|
title: override.title ?? titleCase(name),
|
|
@@ -1272,13 +1272,14 @@ function generatePlatformReactManifest(config) {
|
|
|
1272
1272
|
const { root, module } = config;
|
|
1273
1273
|
const slug = config.slug ?? module;
|
|
1274
1274
|
const src = config.paths?.src ?? "src";
|
|
1275
|
-
const pagesDir = path.resolve(root, config.paths?.pages ?? `${src}/pages/${module}`);
|
|
1276
1275
|
const adapterDir = path.resolve(root, config.paths?.adapter ?? `${src}/adapter/${module}`);
|
|
1277
1276
|
const routeMetaPath = path.resolve(root, config.paths?.routeMeta ?? `${src}/config/routeMeta.json`);
|
|
1278
1277
|
const featureManifestRel = config.paths?.featureManifest ?? "feature.manifest.json";
|
|
1279
1278
|
const overlayRel = config.paths?.overlay ?? "../extension.manifest.json";
|
|
1280
1279
|
const routeMeta = fs.existsSync(routeMetaPath) ? JSON.parse(fs.readFileSync(routeMetaPath, "utf8")) : [];
|
|
1281
|
-
const
|
|
1280
|
+
const pagesCfg = config.paths?.pages ?? `${src}/pages/${module}`;
|
|
1281
|
+
const pageDirs = (Array.isArray(pagesCfg) ? pagesCfg : [pagesCfg]).map((p) => path.resolve(root, p));
|
|
1282
|
+
const exclude = new Set(config.paths?.pageExclude ?? []);
|
|
1282
1283
|
const viewFiles = {};
|
|
1283
1284
|
if (fs.existsSync(adapterDir)) {
|
|
1284
1285
|
for (const f of walk(adapterDir)) {
|
|
@@ -1287,18 +1288,35 @@ function generatePlatformReactManifest(config) {
|
|
|
1287
1288
|
}
|
|
1288
1289
|
}
|
|
1289
1290
|
}
|
|
1290
|
-
const
|
|
1291
|
-
const pages =
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1291
|
+
const seen = /* @__PURE__ */ new Map();
|
|
1292
|
+
const pages = [];
|
|
1293
|
+
for (const dir of pageDirs) {
|
|
1294
|
+
if (!fs.existsSync(dir)) {
|
|
1295
|
+
throw new Error(`generate-manifest: pages dir not found: ${dir}`);
|
|
1296
|
+
}
|
|
1297
|
+
for (const file of fs.readdirSync(dir).filter((f) => f.endsWith(".tsx")).sort()) {
|
|
1298
|
+
if (exclude.has(file)) continue;
|
|
1299
|
+
if (seen.has(file)) {
|
|
1300
|
+
throw new Error(
|
|
1301
|
+
`generate-manifest: duplicate page filename "${file}" in both ${seen.get(file)} and ${dir}`
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
seen.set(file, dir);
|
|
1305
|
+
const relDir = slash2(path.relative(root, dir));
|
|
1306
|
+
const moduleSpecifier = relDir ? `${relDir}/${file}` : file;
|
|
1307
|
+
pages.push({
|
|
1308
|
+
file,
|
|
1309
|
+
content: fs.readFileSync(path.resolve(dir, file), "utf8"),
|
|
1310
|
+
moduleSpecifier
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1295
1314
|
const { entries, missingViews } = computePlatformReactPages({
|
|
1296
1315
|
module,
|
|
1297
1316
|
slug,
|
|
1298
1317
|
routeMeta,
|
|
1299
1318
|
pages,
|
|
1300
1319
|
viewFiles,
|
|
1301
|
-
pagesDirRel,
|
|
1302
1320
|
pageOverrides: config.pageOverrides
|
|
1303
1321
|
});
|
|
1304
1322
|
const schema = config.manifest.schema ?? DEFAULT_SCHEMA;
|