create-ampless 0.2.0-alpha.12 → 0.2.0-alpha.13

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.
@@ -7,13 +7,14 @@
7
7
  // `amplify_outputs.json` and `cms.config` into a single `Admin`
8
8
  // instance.
9
9
  //
10
- // NOTE: We intentionally do NOT pass an `ampless` instance to
11
- // createAdmin. That would import `lib/ampless.ts`, which imports
12
- // `themes-registry`, which (via theme pages `lib/i18n.ts`) imports
13
- // back to this file a circular chain that crashes with a TDZ
14
- // ReferenceError on `ampless` at module init. `createAdmin` builds
15
- // its own internal Ampless when omitted, which is functionally
16
- // equivalent for admin's needs.
10
+ // NOTE: we pass `ampless` as a thunk (not the resolved instance) so we
11
+ // don't have a static `import './ampless'` at the top of this file.
12
+ // A static import would form the cycle
13
+ // `lib/admin.ts lib/ampless.ts themes-registry themes lib/i18n.ts lib/admin.ts`
14
+ // and crash with a TDZ ReferenceError on `ampless` at module init.
15
+ // The thunk uses dynamic `import()` so `lib/ampless.ts` only loads on
16
+ // the first `loadSiteSettings` / `loadThemeConfig` call (request
17
+ // time), by which point every module has finished initialising.
17
18
 
18
19
  import outputs from '../amplify_outputs.json'
19
20
  import cmsConfig from '@/cms.config'
@@ -22,6 +23,7 @@ import { createAdmin } from '@ampless/admin'
22
23
  export const admin = createAdmin({
23
24
  outputs,
24
25
  cmsConfig,
26
+ ampless: async () => (await import('./ampless')).ampless,
25
27
  locale: (cmsConfig as { locale?: string }).locale ?? 'en',
26
28
  })
27
29
 
@@ -27,7 +27,7 @@
27
27
  "@ampless/plugin-rss": "^0.2.0-alpha.3",
28
28
  "@ampless/plugin-seo": "^0.2.0-alpha.3",
29
29
  "@ampless/plugin-webhook": "^0.2.0-alpha.3",
30
- "@ampless/admin": "^0.2.0-alpha.11",
30
+ "@ampless/admin": "^0.2.0-alpha.12",
31
31
  "@ampless/backend": "^0.2.0-alpha.5",
32
32
  "@ampless/runtime": "^0.2.0-alpha.5",
33
33
  "@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "0.2.0-alpha.12",
3
+ "version": "0.2.0-alpha.13",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",