@danypops/pi-packed 0.28.8 → 0.28.9
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/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The extension connects to Packed's authenticated user daemon and starts the pack
|
|
|
10
10
|
|
|
11
11
|
## Isolated daemon services
|
|
12
12
|
|
|
13
|
-
Packed materializes every managed daemon into a private, versioned npm project under its state directory (`services/<package>/<version>/`). Each root has its own `package.json`, lockfile, and `node_modules`; Pi's shared global project, root-level `overrides`, hoisting, and unrelated package updates therefore cannot rewrite a daemon's dependency closure. Downloads still use npm's shared cache.
|
|
13
|
+
Packed materializes every managed daemon into a private, versioned npm project under its state directory (`services/<package>/<version>/`). Each root has its own `package.json`, lockfile, and `node_modules`; Pi's shared global project, root-level `overrides`, hoisting, and unrelated package updates therefore cannot rewrite a daemon's dependency closure. npm may hoist dependencies inside that one private root for ordinary package compatibility, but never across service roots. Downloads still use npm's shared cache.
|
|
14
14
|
|
|
15
15
|
A complete root is activated only after installation and manifest validation, using an atomic directory rename. Armada switches the persistent service to that root, and Packed retains the previous root for rollback while pruning older versions within a fixed bound. Removing the service removes its private roots. Pi extensions remain installed in Pi's own package project; only their daemon processes run from the isolated closure.
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolated-service-install.d.ts","sourceRoot":"","sources":["../../service/src/daemon/isolated-service-install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isolated-service-install.d.ts","sourceRoot":"","sources":["../../service/src/daemon/isolated-service-install.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACzC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAChF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAuDD,qBAAa,oCAAqC,YAAW,yBAAyB;IAC/E,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIrF,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE7B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGtC;AAED;;;;;;GAMG;AACH,qBAAa,iCAAkC,YAAW,yBAAyB;IAEjF,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,MAAM,EACtB,MAAM,SAAgE;IAGlF,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAwFrF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM5B,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,KAAK;CAkBb"}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, s
|
|
|
2
2
|
import { join, sep } from "node:path";
|
|
3
3
|
import { npmPackageName } from "../packages/installed.ts";
|
|
4
4
|
|
|
5
|
+
const INSTALL_FORMAT_VERSION = 1;
|
|
5
6
|
const MAX_VERSION_DIRECTORIES = 20;
|
|
6
7
|
const MAX_TEMP_DIRECTORY_SCAN = 100;
|
|
7
8
|
const RETAINED_VERSION_DIRECTORIES = 2;
|
|
@@ -64,6 +65,17 @@ function resolvedPackageJson(piHome: string, packageName: string): string {
|
|
|
64
65
|
return join(packageDirectory(piHome, packageName), "package.json");
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
function hasCurrentInstallFormat(piHome: string): boolean {
|
|
69
|
+
try {
|
|
70
|
+
const project = JSON.parse(readFileSync(join(piHome, "npm", "package.json"), "utf8")) as {
|
|
71
|
+
packedServiceInstallFormat?: unknown;
|
|
72
|
+
};
|
|
73
|
+
return project.packedServiceInstallFormat === INSTALL_FORMAT_VERSION;
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
67
79
|
export class PassThroughDaemonPackageMaterializer implements DaemonPackageMaterializer {
|
|
68
80
|
async materialize(piHome: string, source: string): Promise<MaterializedDaemonPackage> {
|
|
69
81
|
return { piHome, source, commit() {}, rollback() {} };
|
|
@@ -102,7 +114,7 @@ export class IsolatedDaemonPackageMaterializer implements DaemonPackageMateriali
|
|
|
102
114
|
const finalPackageJson = resolvedPackageJson(finalPiHome, packageName);
|
|
103
115
|
mkdirSync(packageRoot, { recursive: true, mode: 0o700 });
|
|
104
116
|
this.pruneTemporaryDirectories(packageRoot);
|
|
105
|
-
if (readVersion(finalPackageJson) === version) {
|
|
117
|
+
if (readVersion(finalPackageJson) === version && hasCurrentInstallFormat(finalPiHome)) {
|
|
106
118
|
return {
|
|
107
119
|
piHome: finalPiHome,
|
|
108
120
|
source: `npm:${packageName}@${version}`,
|
|
@@ -118,7 +130,16 @@ export class IsolatedDaemonPackageMaterializer implements DaemonPackageMateriali
|
|
|
118
130
|
mkdirSync(projectDirectory, { recursive: true, mode: 0o700 });
|
|
119
131
|
writeFileSync(
|
|
120
132
|
join(projectDirectory, "package.json"),
|
|
121
|
-
JSON.stringify(
|
|
133
|
+
JSON.stringify(
|
|
134
|
+
{
|
|
135
|
+
name: `packed-service-${installKey(packageName)}`,
|
|
136
|
+
private: true,
|
|
137
|
+
packedServiceInstallFormat: INSTALL_FORMAT_VERSION,
|
|
138
|
+
dependencies: { [packageName]: version },
|
|
139
|
+
},
|
|
140
|
+
null,
|
|
141
|
+
2,
|
|
142
|
+
),
|
|
122
143
|
);
|
|
123
144
|
|
|
124
145
|
let publishedByThisCall = false;
|
|
@@ -130,7 +151,6 @@ export class IsolatedDaemonPackageMaterializer implements DaemonPackageMateriali
|
|
|
130
151
|
"--ignore-scripts",
|
|
131
152
|
"--no-audit",
|
|
132
153
|
"--no-fund",
|
|
133
|
-
"--install-strategy=nested",
|
|
134
154
|
"--loglevel=error",
|
|
135
155
|
],
|
|
136
156
|
{ cwd: projectDirectory, stdout: "pipe", stderr: "pipe", env: process.env },
|
|
@@ -30,6 +30,7 @@ const fs = require("node:fs");
|
|
|
30
30
|
const path = require("node:path");
|
|
31
31
|
const project = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf8"));
|
|
32
32
|
if (project.overrides) throw new Error("host overrides leaked into isolated project");
|
|
33
|
+
if (project.packedServiceInstallFormat !== 1) throw new Error("missing isolated install format marker");
|
|
33
34
|
const [name, version] = Object.entries(project.dependencies)[0];
|
|
34
35
|
const vehicleVersions = ${JSON.stringify(vehicleVersions)};
|
|
35
36
|
const vehicleVersion = typeof vehicleVersions === "string" ? vehicleVersions : vehicleVersions[name];
|