@acryldev/blends 1.7.0 → 1.7.2

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.
@@ -35,11 +35,8 @@ registerHooks({ load(url, context, nextLoad) {
35
35
  */
36
36
  const plugins = new URL("../../", import.meta.url);
37
37
  const appRoot = new URL("../", plugins).href;
38
- const family = new URL("instance/bundle.ts", plugins);
39
- if (existsSync(fileURLToPath(family))) {
40
- const { appTree } = await import(family.href);
41
- if (appTree(process.env, fileURLToPath(appRoot)) !== void 0) usePackagesOfProgram(fileURLToPath(appRoot));
42
- }
38
+ const program = process.env.ACRYLBLENDS_PROGRAM?.trim();
39
+ if (program) usePackagesOfProgram(program);
43
40
  const resolver = new URL("extensions/resolve.ts", plugins);
44
41
  if (existsSync(fileURLToPath(new URL("router/src/index.ts", plugins))) && existsSync(fileURLToPath(resolver))) {
45
42
  const { routerAliases } = await import(resolver.href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/blends",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -426,8 +426,8 @@
426
426
  ],
427
427
  "private": false,
428
428
  "devDependencies": {
429
- "@deepseek-ai/cordis": "4.0.4",
430
429
  "@acryldev/framework": "0.5.0",
430
+ "@deepseek-ai/cordis": "4.0.4",
431
431
  "tsdown": "0.23.0",
432
432
  "vitest": "5.0.3"
433
433
  },
@@ -23,10 +23,6 @@
23
23
  "types": "./lib/types/index.d.ts",
24
24
  "default": "./lib/index.js"
25
25
  },
26
- "./drivers": {
27
- "types": "./lib/types/drivers.d.ts",
28
- "default": "./lib/drivers.js"
29
- },
30
26
  "./headless": {
31
27
  "types": "./lib/types/headless.d.ts",
32
28
  "default": "./lib/headless.js"
@@ -8,7 +8,7 @@ import { existsSync, readFileSync } from 'node:fs'
8
8
  import { connect } from 'node:net'
9
9
  import { join, resolve } from 'node:path'
10
10
  import { fileURLToPath, pathToFileURL } from 'node:url'
11
- import { appDataHome } from '@acryldev/instance'
11
+ import { appDataHome, PROGRAM_ENV } from '@acryldev/instance'
12
12
 
13
13
  /** The launcher every frame app has; without it the app runs on its own server (made before the frame). */
14
14
  export const HOST_SCRIPT = join('scripts', 'ide-host.mjs')
@@ -173,7 +173,7 @@ export interface FrameHostLaunch {
173
173
  readonly runtime?: string
174
174
  /**
175
175
  * Where the Program is when it is not in the app folder: a product's bundle. The host, its loader and the resolver that serves the Program from there
176
- * and the person's files from the app's source (plugins/instance/bundle-overlay.ts) start from it; the host still runs in the app folder.
176
+ * and the person's files from the app's source (@acryldev/instance/bundle-overlay, told where by ACRYLBLENDS_PROGRAM) start from it; the host still runs in the app folder.
177
177
  */
178
178
  readonly program?: string
179
179
  }
@@ -186,6 +186,13 @@ export interface FrameHostLaunch {
186
186
  */
187
187
  export const WATCHED_IN_SOURCE = ['src', 'plugins', 'blend.yaml'] as const
188
188
 
189
+ /**
190
+ * The packaged host's preloads, from the packages this shell depends on, never from the app's folders: an app's copy of a framework plugin may be
191
+ * named differently or absent (a product's bundle has @acryldev/instance installed, not copied; spec 051 T011 and T038), and the host never started.
192
+ */
193
+ export const HOST_LOADER = import.meta.resolve('@acryldev/node-server/register')
194
+ export const BUNDLE_OVERLAY = import.meta.resolve('@acryldev/instance/bundle-overlay')
195
+
189
196
  /** The packaged host's watcher (watch-host.mjs, next to this file): node --watch's restarts, on a real change of a file only, never an access-time event. */
190
197
  export const WATCH_HOST = fileURLToPath(new URL('./watch-host.mjs', import.meta.url))
191
198
 
@@ -208,13 +215,8 @@ export function packagedHostArgs(
208
215
  '--',
209
216
  // The loader first and the overlay second: a hook registered later runs first, so the overlay sees every import before the loader's aliases.
210
217
  '--import',
211
- pathToFileURL(join(program, 'plugins', 'node-server', 'src', 'register.ts')).href,
212
- ...(program === root
213
- ? []
214
- : [
215
- '--import',
216
- pathToFileURL(join(program, 'plugins', 'instance', 'bundle-overlay.ts')).href,
217
- ]),
218
+ HOST_LOADER,
219
+ ...(program === root ? [] : ['--import', BUNDLE_OVERLAY]),
218
220
  join(program, HOST_SCRIPT),
219
221
  ]
220
222
  }
@@ -240,6 +242,7 @@ export function startFrameHost(
240
242
  ...(launch.runtime === undefined
241
243
  ? { ELECTRON_RUN_AS_NODE: undefined }
242
244
  : { ELECTRON_RUN_AS_NODE: '1' }),
245
+ ...(launch.runtime !== undefined && program !== root ? { [PROGRAM_ENV]: program } : {}),
243
246
  },
244
247
  stdio: ['ignore', 'pipe', 'pipe'],
245
248
  shell: command.shell,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/desktop-shell",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Run the app as a desktop app: an Electron window on the app's own server. `npm run desktop`; the app's code never imports electron.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,6 +53,7 @@
53
53
  "typescript": "6.0.3"
54
54
  },
55
55
  "scripts": {
56
- "build": "tsdown && tsc -p tsconfig.json --emitDeclarationOnly && node scripts/copy-assets.mjs"
56
+ "build": "tsdown && tsc -p tsconfig.json --emitDeclarationOnly && node scripts/copy-assets.mjs",
57
+ "prepack": "node scripts/copy-assets.mjs"
57
58
  }
58
59
  }
@@ -3,8 +3,9 @@
3
3
  * resolves from the bundle and the person's files from the app's source. A no-op in an app made with `acrylblends init`, which is one folder.
4
4
  */
5
5
  import { registerHooks } from 'node:module'
6
- import { fileURLToPath } from 'node:url'
7
6
  import { appTree, overlayResolve } from './bundle.ts'
7
+ import { PROGRAM_ENV } from './index.ts'
8
8
 
9
- const tree = appTree(process.env, fileURLToPath(new URL('../../', import.meta.url)))
9
+ const program = process.env[PROGRAM_ENV]?.trim()
10
+ const tree = program ? appTree(process.env, program) : undefined
10
11
  if (tree !== undefined) registerHooks({ resolve: overlayResolve(tree) })
@@ -64,6 +64,12 @@ export const HOME_ENV = 'ACRYLBLENDS_HOME'
64
64
  */
65
65
  export const ROOT_ENV = 'ACRYLBLENDS_ROOT'
66
66
  export const PORT_ENV = 'ACRYLBLENDS_PORT'
67
+ /**
68
+ * The Program's folder (a product's bundle) when the frame host runs it on an app's `source`: the preloads that serve the Program from there
69
+ * (bundle-overlay.ts, the node server's register) are installed packages, so their own location does not say where the bundle is. Set by the
70
+ * desktop shell's packaged host only (frame.ts startFrameHost).
71
+ */
72
+ export const PROGRAM_ENV = 'ACRYLBLENDS_PROGRAM'
67
73
  /** The app's name, for a process that runs from the bundle on the app's `source` folder: the folder's own name says nothing (`source`). Set by `instanceEnv`. */
68
74
  export const NAME_ENV = 'ACRYLBLENDS_NAME'
69
75
  export const HOST_ENV = 'ACRYLBLENDS_HOST'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/instance",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Where the app keeps things (home, port, run lock), chosen once from the environment or the project folder.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,10 @@
40
40
  "types": "./lib/types/home.d.ts",
41
41
  "default": "./lib/home.js"
42
42
  },
43
+ "./bundle-overlay": {
44
+ "types": "./lib/types/bundle-overlay.d.ts",
45
+ "default": "./lib/bundle-overlay.js"
46
+ },
43
47
  "./package.json": "./package.json"
44
48
  },
45
49
  "dependencies": {},
@@ -11,6 +11,7 @@
11
11
  "": "index.ts",
12
12
  "/storage": "storage.ts",
13
13
  "/bundle": "bundle.ts",
14
- "/home": "home.ts"
14
+ "/home": "home.ts",
15
+ "/bundle-overlay": "bundle-overlay.ts"
15
16
  }
16
17
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/node-server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The framework's standalone HTTP adapter, one Cordis service: serves the whole router from a node:http listener where the ACRYL Host is not running",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,14 +37,10 @@ registerHooks({
37
37
  const plugins = new URL('../../', import.meta.url)
38
38
  const appRoot = new URL('../', plugins).href
39
39
  // A desktop product's frame host runs the Program from the bundle on an app's source, which holds only the person's files: their JSX compiles with the
40
- // Program's `typescript` (the instance family says whether this is such a host; a published framework has no family beside it).
41
- const family = new URL('instance/bundle.ts', plugins)
42
- if (existsSync(fileURLToPath(family))) {
43
- const { appTree } = (await import(family.href)) as {
44
- appTree(env: NodeJS.ProcessEnv, bundle: string): unknown
45
- }
46
- if (appTree(process.env, fileURLToPath(appRoot)) !== undefined) usePackagesOfProgram(fileURLToPath(appRoot))
47
- }
40
+ // Program's `typescript`. The desktop shell names the bundle in ACRYLBLENDS_PROGRAM (@acryldev/instance PROGRAM_ENV); this loader is then the installed
41
+ // package, so its own location says nothing about the bundle.
42
+ const program = process.env.ACRYLBLENDS_PROGRAM?.trim()
43
+ if (program) usePackagesOfProgram(program)
48
44
  const resolver = new URL('extensions/resolve.ts', plugins)
49
45
  if (existsSync(fileURLToPath(new URL('router/src/index.ts', plugins))) && existsSync(fileURLToPath(resolver))) {
50
46
  const { routerAliases } = (await import(resolver.href)) as { routerAliases(): Record<string, string> }