@lukoweb/apitogo 0.2.20 → 0.2.21
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/cli/cli.js +17 -9
- package/package.json +1 -1
- package/src/vite/config.ts +2 -2
- package/src/vite/watch-ignore.ts +34 -9
package/dist/cli/cli.js
CHANGED
|
@@ -5729,8 +5729,8 @@ async function warnIfOutdatedVersion(currentVersion) {
|
|
|
5729
5729
|
if (!process.env.ZUDOKU_OVERRIDE_CI_TO_TEST && (process.env.CI || process.env.ZUDOKU_DISABLE_UPDATE_CHECK)) {
|
|
5730
5730
|
return false;
|
|
5731
5731
|
}
|
|
5732
|
-
const versionCheckInfo = await getVersionCheckInfo();
|
|
5733
|
-
if (!versionCheckInfo
|
|
5732
|
+
const versionCheckInfo = await getVersionCheckInfo().catch(() => void 0);
|
|
5733
|
+
if (!versionCheckInfo?.latestVersion) {
|
|
5734
5734
|
return false;
|
|
5735
5735
|
}
|
|
5736
5736
|
const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion) && !process.env.ZUDOKU_INTERNAL_DEV;
|
|
@@ -9807,7 +9807,7 @@ import {
|
|
|
9807
9807
|
// package.json
|
|
9808
9808
|
var package_default = {
|
|
9809
9809
|
name: "@lukoweb/apitogo",
|
|
9810
|
-
version: "0.2.
|
|
9810
|
+
version: "0.2.21",
|
|
9811
9811
|
type: "module",
|
|
9812
9812
|
sideEffects: [
|
|
9813
9813
|
"**/*.css",
|
|
@@ -13861,14 +13861,18 @@ import path40 from "node:path";
|
|
|
13861
13861
|
var STATE_INSIDE_CONTENT = /[\\/]content[\\/](?:\.apitogo|apitogo[\\/]\.state)(?:[\\/]|$)/;
|
|
13862
13862
|
var within = (base, file) => file === base || file.startsWith(base + path40.sep);
|
|
13863
13863
|
var unique = (paths) => [...new Set(paths)];
|
|
13864
|
-
function
|
|
13865
|
-
let workspace = false;
|
|
13864
|
+
function isWorkspace(root) {
|
|
13866
13865
|
try {
|
|
13867
|
-
|
|
13866
|
+
return path40.basename(root) === "generated" && lstatSync(path40.join(root, "content")).isSymbolicLink();
|
|
13868
13867
|
} catch {
|
|
13869
|
-
|
|
13868
|
+
return false;
|
|
13870
13869
|
}
|
|
13871
|
-
|
|
13870
|
+
}
|
|
13871
|
+
function tenantDir(root) {
|
|
13872
|
+
return isWorkspace(root) ? realpathSync(path40.join(root, "content")) : void 0;
|
|
13873
|
+
}
|
|
13874
|
+
function stateIgnore(root) {
|
|
13875
|
+
if (!isWorkspace(root)) return void 0;
|
|
13872
13876
|
const state = path40.dirname(root);
|
|
13873
13877
|
const states = unique([state, realpathSync(state)]);
|
|
13874
13878
|
const roots = unique([root, realpathSync(root)]);
|
|
@@ -13878,6 +13882,10 @@ function stateIgnore(root) {
|
|
|
13878
13882
|
return STATE_INSIDE_CONTENT.test(file);
|
|
13879
13883
|
};
|
|
13880
13884
|
}
|
|
13885
|
+
function devServerAllow(root, moduleDir) {
|
|
13886
|
+
const tenant = tenantDir(root);
|
|
13887
|
+
return [root, path40.dirname(root), moduleDir, ...tenant ? [tenant] : []];
|
|
13888
|
+
}
|
|
13881
13889
|
|
|
13882
13890
|
// src/vite/config.ts
|
|
13883
13891
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
@@ -13963,7 +13971,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13963
13971
|
middlewareMode: true,
|
|
13964
13972
|
open: true,
|
|
13965
13973
|
fs: {
|
|
13966
|
-
allow:
|
|
13974
|
+
allow: devServerAllow(dir, config2.__meta.moduleDir)
|
|
13967
13975
|
},
|
|
13968
13976
|
watch: {
|
|
13969
13977
|
ignored: [
|
package/package.json
CHANGED
package/src/vite/config.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { loadDevPortalViteDefines } from "./dev-portal-env.js";
|
|
|
19
19
|
import { findPackageRoot } from "./package-root.js";
|
|
20
20
|
import { ensurePagefindDevStub } from "./pagefind-dev-stub.js";
|
|
21
21
|
import vitePlugin from "./plugin.js";
|
|
22
|
-
import { stateIgnore } from "./watch-ignore.js";
|
|
22
|
+
import { devServerAllow, stateIgnore } from "./watch-ignore.js";
|
|
23
23
|
import { getZuploSystemConfigurations } from "./zuplo.js";
|
|
24
24
|
|
|
25
25
|
/** Resolved absolute public directory (Vite default: `<root>/public`). */
|
|
@@ -144,7 +144,7 @@ export async function getViteConfig(
|
|
|
144
144
|
middlewareMode: true,
|
|
145
145
|
open: true,
|
|
146
146
|
fs: {
|
|
147
|
-
allow:
|
|
147
|
+
allow: devServerAllow(dir, config.__meta.moduleDir),
|
|
148
148
|
},
|
|
149
149
|
watch: {
|
|
150
150
|
ignored: [
|
package/src/vite/watch-ignore.ts
CHANGED
|
@@ -14,6 +14,29 @@ const within = (base: string, file: string) =>
|
|
|
14
14
|
|
|
15
15
|
const unique = (paths: string[]) => [...new Set(paths)];
|
|
16
16
|
|
|
17
|
+
/** Whether `root` is the site root (`<state>/generated`) of a config version 2 workspace: it has the `content` link. */
|
|
18
|
+
function isWorkspace(root: string): boolean {
|
|
19
|
+
try {
|
|
20
|
+
return (
|
|
21
|
+
path.basename(root) === "generated" &&
|
|
22
|
+
lstatSync(path.join(root, "content")).isSymbolicLink()
|
|
23
|
+
);
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The tenant's own folder of a config version 2 workspace (what `content` links to), or `undefined` for any other
|
|
31
|
+
* project. The site root sits inside the state folder, so the folder that holds `node_modules` and the pages is
|
|
32
|
+
* outside it and the dev server has to be told it may serve files from there.
|
|
33
|
+
*/
|
|
34
|
+
export function tenantDir(root: string): string | undefined {
|
|
35
|
+
return isWorkspace(root)
|
|
36
|
+
? realpathSync(path.join(root, "content"))
|
|
37
|
+
: undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
17
40
|
/**
|
|
18
41
|
* What the dev server's watcher must leave alone in a config version 2 workspace, or `undefined` for any other
|
|
19
42
|
* project. The watcher meets the state folder twice: below the `content` link and, after resolving the link,
|
|
@@ -23,15 +46,7 @@ const unique = (paths: string[]) => [...new Set(paths)];
|
|
|
23
46
|
export function stateIgnore(
|
|
24
47
|
root: string,
|
|
25
48
|
): ((file: string) => boolean) | undefined {
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
workspace =
|
|
29
|
-
path.basename(root) === "generated" &&
|
|
30
|
-
lstatSync(path.join(root, "content")).isSymbolicLink();
|
|
31
|
-
} catch {
|
|
32
|
-
workspace = false;
|
|
33
|
-
}
|
|
34
|
-
if (!workspace) return undefined;
|
|
49
|
+
if (!isWorkspace(root)) return undefined;
|
|
35
50
|
|
|
36
51
|
const state = path.dirname(root);
|
|
37
52
|
const states = unique([state, realpathSync(state)]);
|
|
@@ -43,3 +58,13 @@ export function stateIgnore(
|
|
|
43
58
|
return STATE_INSIDE_CONTENT.test(file);
|
|
44
59
|
};
|
|
45
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The folders the dev server may serve files from. The site root of a config version 2 workspace sits inside the
|
|
64
|
+
* state folder, so the package (`node_modules`) and the tenant's pages are outside it. Without them the page's main
|
|
65
|
+
* script fails with "Failed to load url ... Does the file exist?" and the server stops.
|
|
66
|
+
*/
|
|
67
|
+
export function devServerAllow(root: string, moduleDir: string): string[] {
|
|
68
|
+
const tenant = tenantDir(root);
|
|
69
|
+
return [root, path.dirname(root), moduleDir, ...(tenant ? [tenant] : [])];
|
|
70
|
+
}
|