@synopackageland/cli 0.49.0 → 0.49.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.49.1
4
+
5
+ - Pass the same build-stamped App bundle URL to SDK entry preload and mount for every generated mobile App entry
6
+ - Require templates ~0.41.1 with SDK/App 0.51.1 defaults and frontend SDK range ~0.51.1
7
+ - Preserve classic script loading and Apps without mobile registration
8
+
3
9
  ## 0.49.0
4
10
 
5
11
  - Add the `mobile` declaration for native and gateway Apps, with localized registration, generated icons, intake rules and build-consistency checks during inspection
@@ -89,10 +89,10 @@ export async function renderMobileAssets(manifest, uiDigest, moduleVersion) {
89
89
  hash.update(path).update(bytes);
90
90
  const version = hash.digest('hex');
91
91
  if (mobile.entry === 'app') {
92
- const app = moduleVersion ? `./${moduleVersion}/${MODULE_UI_ENTRY}` : './app.js';
92
+ const appBundle = `${moduleVersion ? `./${moduleVersion}/${MODULE_UI_ENTRY}` : './app.js'}?v=${version}`;
93
93
  const options = {
94
94
  packageId: manifest.package, build: version, displayName: name.en,
95
- appIcon: `./icons/mobile-192.png?v=${version}`,
95
+ appIcon: `./icons/mobile-192.png?v=${version}`, appBundle,
96
96
  ...(manifest.portal ? { portal: { defaultAlias: manifest.portal.alias } } : {}),
97
97
  requestTimeout,
98
98
  ...(manifest.i18n?.catalogs ? { messages: manifest.i18n.catalogs } : {}),
@@ -100,8 +100,8 @@ export async function renderMobileAssets(manifest, uiDigest, moduleVersion) {
100
100
  // Classic bundles rely on document.currentScript.dataset.package; keep
101
101
  // their script carrier rather than evaluating them as an ES module.
102
102
  const loadApp = moduleVersion
103
- ? `import(${json(app + '?v=' + version)})`
104
- : `new Promise((resolve,reject)=>{const script=document.createElement('script');script.src=new URL(${json(app + '?v=' + version)},import.meta.url).href;script.dataset.package=${json(manifest.package)};script.onload=()=>resolve(window.DsmPackageApps?.[${json(manifest.package)}]);script.onerror=reject;document.head.appendChild(script)})`;
103
+ ? `import(${json(appBundle)})`
104
+ : `new Promise((resolve,reject)=>{const script=document.createElement('script');script.src=new URL(${json(appBundle)},import.meta.url).href;script.dataset.package=${json(manifest.package)};script.onload=()=>resolve(window.DsmPackageApps?.[${json(manifest.package)}]);script.onerror=reject;document.head.appendChild(script)})`;
105
105
  const source = `import {bootEntryPage} from ${json(entryModule(manifest))};\nbootEntryPage({...${json(options)},root:document.querySelector('.dsmapp-root'),mount:async(root,ctx)=>{const app=await ${loadApp};if(typeof app?.mount!=='function')throw new Error('The UI must export mount(root, ctx)');return app.mount(root,ctx)}});`;
106
106
  const bundled = await build({ stdin: { contents: source, resolveDir: manifest.root, sourcefile: 'synopkgland-entry.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, plugins: [{ name: 'app-import', setup(api) { api.onResolve({ filter: /[?]v=/ }, args => ({ path: args.path, external: true })); } }], legalComments: 'inline' });
107
107
  files.set('entry.js', Buffer.from(bundled.outputFiles[0].text));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.49.0",
3
+ "version": "0.49.1",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@napi-rs/keyring": "^2.1.1",
42
- "@synopackageland/templates": "~0.41.0",
42
+ "@synopackageland/templates": "~0.41.1",
43
43
  "ajv": "^8.17.1",
44
44
  "commander": "^13.1.0",
45
45
  "esbuild": "^0.28.2",
@@ -23,8 +23,8 @@ mobile:
23
23
 
24
24
  `entry: app` requires an SDK UI exporting `mount(root, ctx)` as `app.module.js`,
25
25
  or a classic `app.js` registering `window.DsmPackageApps[packageId]`.
26
- Install `@synopackageland/sdk` with its `/entry` export in the UI build directory
27
- or project root. The CLI bundles this installed SDK into `entry.js`; the NAS
26
+ Install the current `@synopackageland/sdk` with its `/entry` export in the UI
27
+ build directory or project root. The CLI bundles this installed SDK into `entry.js`; the NAS
28
28
  never loads npm or a CDN. Plain UI Apps can install the SDK at the project root.
29
29
  Run the normal UI build before `synopkgland check` and `synopkgland build`.
30
30
 
@@ -49,7 +49,11 @@ and bundled `entry.js` into the SPK only. The generated DSM window loads
49
49
  to the same SDK context builder. One immutable content hash appears in
50
50
  the entry build meta tag, `bootEntryPage.build`, registration, and every generated
51
51
  entry script, stylesheet and icon URL. Module UI assets retain their immutable
52
- snapshot directory. SDK boot owns token acquisition, non-aborting hedges, portal
52
+ snapshot directory. The generated `bootEntryPage.appBundle` is the exact URL
53
+ loaded by `mount`, including its build query. SDK boot preloads same-origin App
54
+ assets while token/identity requests run; App execution still waits for verified
55
+ identity. Classic bundles retain their script carrier and package dataset.
56
+ SDK boot owns token acquisition, non-aborting hedges, portal
53
57
  probing, language fallback and the package-specific identity cache.
54
58
 
55
59
  App-owned `app.status` should use SDK Go `api.AppStatusHandler`, registered via