@amplifyup/sdk 0.2.4 → 0.3.0
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 +13 -1
- package/dist/{AmplifyRenderer-BNWBrFQN.d.ts → AmplifyRenderer-CwAYY8K1.d.mts} +4 -5
- package/dist/{AmplifyRenderer-CPUr9Bkc.d.mts → AmplifyRenderer-D40crBWY.d.ts} +4 -5
- package/dist/AmplifyRenderer.d.mts +2 -3
- package/dist/AmplifyRenderer.d.ts +2 -3
- package/dist/AmplifyRenderer.js +3 -30
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +3 -30
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +240 -4
- package/dist/index.d.ts +240 -4
- package/dist/index.js +59 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -2
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +101 -8
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +100 -8
- package/dist/next.mjs.map +1 -1
- package/dist/{query-Xo9cy-2F.d.ts → query-BeQibYGm.d.ts} +56 -56
- package/dist/{query-DYjs4LQQ.d.mts → query-CwtZtJX8.d.mts} +56 -56
- package/dist/react.d.mts +23 -17
- package/dist/react.d.ts +23 -17
- package/dist/react.js +4 -31
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +4 -31
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/dist/{types-ffQNIQCK.d.ts → types-CxucvIL6.d.mts} +1 -1
- package/dist/{types-ffQNIQCK.d.mts → types-CxucvIL6.d.ts} +1 -1
- package/package.json +8 -7
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -266
- package/dist/cli.js.map +0 -1
- package/dist/cli.mjs +0 -260
- package/dist/cli.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -121,9 +121,10 @@ The generated `.amplifyup` folder ignores itself in git. Don't edit it.
|
|
|
121
121
|
|
|
122
122
|
### Without the Next plugin
|
|
123
123
|
|
|
124
|
-
For CI steps or non-Next builds, run
|
|
124
|
+
The SDK has no command of its own. For CI steps or non-Next builds, install [`@amplifyup/cli`](https://www.npmjs.com/package/@amplifyup/cli) and run it before your build:
|
|
125
125
|
|
|
126
126
|
```bash
|
|
127
|
+
npm install --save-dev @amplifyup/cli
|
|
127
128
|
npx amplifyup registry # build once
|
|
128
129
|
npx amplifyup registry --watch # rebuild as files are added, renamed or removed
|
|
129
130
|
```
|
|
@@ -134,6 +135,17 @@ If a page uses a component that isn't in your registry, Composer shows a placeho
|
|
|
134
135
|
|
|
135
136
|
---
|
|
136
137
|
|
|
138
|
+
## Upgrading to 0.3
|
|
139
|
+
|
|
140
|
+
0.3 removes the `amplifyup` command from this package. Nothing else changes.
|
|
141
|
+
|
|
142
|
+
| You use | Do this |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| `withAmplifyUp` in `next.config` | Nothing. The plugin still builds your registry. |
|
|
145
|
+
| `amplifyup registry` in a script or CI step | `npm install --save-dev @amplifyup/cli`. The same command and flags now come from there. |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
137
149
|
## Upgrading from 0.1
|
|
138
150
|
|
|
139
151
|
0.2.0 removes hand-written rendering. `renderComponent` and the `ComponentContextProvider` export are gone, and passing `renderComponent` throws an error that points here.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { P as PageConfig } from './types-ffQNIQCK.js';
|
|
3
|
+
import { P as PageConfig } from './types-CxucvIL6.mjs';
|
|
5
4
|
|
|
6
5
|
declare const REGISTRY_BRAND: unique symbol;
|
|
7
6
|
type SiteComponent = ComponentType<any>;
|
|
@@ -41,7 +40,7 @@ interface AmplifyRendererProps {
|
|
|
41
40
|
*/
|
|
42
41
|
composerPreview?: boolean;
|
|
43
42
|
}
|
|
44
|
-
declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps):
|
|
45
|
-
declare const AmplifyRenderer:
|
|
43
|
+
declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps): React.JSX.Element | null;
|
|
44
|
+
declare const AmplifyRenderer: React.MemoExoticComponent<typeof AmplifyRendererInner>;
|
|
46
45
|
|
|
47
46
|
export { AmplifyRenderer as A, type ComponentRegistry as C, defineComponentRegistry as d };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { P as PageConfig } from './types-ffQNIQCK.mjs';
|
|
3
|
+
import { P as PageConfig } from './types-CxucvIL6.js';
|
|
5
4
|
|
|
6
5
|
declare const REGISTRY_BRAND: unique symbol;
|
|
7
6
|
type SiteComponent = ComponentType<any>;
|
|
@@ -41,7 +40,7 @@ interface AmplifyRendererProps {
|
|
|
41
40
|
*/
|
|
42
41
|
composerPreview?: boolean;
|
|
43
42
|
}
|
|
44
|
-
declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps):
|
|
45
|
-
declare const AmplifyRenderer:
|
|
43
|
+
declare function AmplifyRendererInner(rendererProps: AmplifyRendererProps): React.JSX.Element | null;
|
|
44
|
+
declare const AmplifyRenderer: React.MemoExoticComponent<typeof AmplifyRendererInner>;
|
|
46
45
|
|
|
47
46
|
export { AmplifyRenderer as A, type ComponentRegistry as C, defineComponentRegistry as d };
|
package/dist/AmplifyRenderer.js
CHANGED
|
@@ -433,7 +433,7 @@ function isComposerPreview() {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
// src/field-envelope.ts
|
|
436
|
-
var FIELDS_BRAND = Symbol("amplifyup.fields");
|
|
436
|
+
var FIELDS_BRAND = /* @__PURE__ */ Symbol("amplifyup.fields");
|
|
437
437
|
var IDENTIFIER_KEYS = /* @__PURE__ */ new Set([
|
|
438
438
|
"id",
|
|
439
439
|
"_id",
|
|
@@ -3546,7 +3546,6 @@ function getSDK(adapter) {
|
|
|
3546
3546
|
sdkInstance.ensureWindowBridge();
|
|
3547
3547
|
return sdkInstance;
|
|
3548
3548
|
}
|
|
3549
|
-
var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
|
|
3550
3549
|
var refreshEventTracking = () => getSDK().refreshEventTracking();
|
|
3551
3550
|
getSDK();
|
|
3552
3551
|
var PageContentRegistryContext = react.createContext(null);
|
|
@@ -3706,7 +3705,7 @@ function ComponentContextProvider({
|
|
|
3706
3705
|
const next = hydratePageResourceProps(props || {}, getPageResourceFields());
|
|
3707
3706
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentContext.Provider, { value: { slots, props: next, layoutNodeId, componentId }, children });
|
|
3708
3707
|
}
|
|
3709
|
-
var REGISTRY_BRAND = Symbol.for("amplifyup.componentRegistry");
|
|
3708
|
+
var REGISTRY_BRAND = /* @__PURE__ */ Symbol.for("amplifyup.componentRegistry");
|
|
3710
3709
|
var isComponentRegistry = (value) => !!value && typeof value === "object" && value[REGISTRY_BRAND] === true;
|
|
3711
3710
|
var warnedMissing = /* @__PURE__ */ new Set();
|
|
3712
3711
|
var warnMissingOnce = (componentId) => {
|
|
@@ -3768,7 +3767,7 @@ var assertComponentRegistry = (owner, props) => {
|
|
|
3768
3767
|
}
|
|
3769
3768
|
if (!isComponentRegistry(props.registry)) {
|
|
3770
3769
|
throw new Error(
|
|
3771
|
-
`[Amplify UP] ${owner} needs your component registry. Render <AmplifyPage /> from the generated .amplifyup/component-registry module (created by withAmplifyUp or \`amplifyup registry\`).`
|
|
3770
|
+
`[Amplify UP] ${owner} needs your component registry. Render <AmplifyPage /> from the generated .amplifyup/component-registry module (created by withAmplifyUp or \`amplifyup registry\` from @amplifyup/cli).`
|
|
3772
3771
|
);
|
|
3773
3772
|
}
|
|
3774
3773
|
};
|
|
@@ -3891,32 +3890,6 @@ function AmplifyRendererInner(rendererProps) {
|
|
|
3891
3890
|
const error = serverPageConfig ? null : clientHook.error;
|
|
3892
3891
|
const contentSource = clientHook.source;
|
|
3893
3892
|
const [variantCache, setVariantCache] = react.useState({});
|
|
3894
|
-
react.useEffect(() => {
|
|
3895
|
-
if (typeof window !== "undefined") {
|
|
3896
|
-
if (window.__AMPLIFYUP_PREVIEW_MODE__ === true) {
|
|
3897
|
-
return;
|
|
3898
|
-
}
|
|
3899
|
-
if (window.location.pathname.includes("/api/pages/proxy")) {
|
|
3900
|
-
return;
|
|
3901
|
-
}
|
|
3902
|
-
if (window.self !== window.top) {
|
|
3903
|
-
return;
|
|
3904
|
-
}
|
|
3905
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
3906
|
-
if (urlParams.get("preview") === "true" || urlParams.get("visualEditor") === "true") {
|
|
3907
|
-
return;
|
|
3908
|
-
}
|
|
3909
|
-
if (window.location.href.includes("preview=true") || window.location.href.includes("visualEditor=true")) {
|
|
3910
|
-
return;
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
if (pageConfig && pageConfig.id !== "default") {
|
|
3914
|
-
trackContentView(pageConfig.id, "page", {
|
|
3915
|
-
route: pageConfig.route,
|
|
3916
|
-
title: pageConfig.title
|
|
3917
|
-
});
|
|
3918
|
-
}
|
|
3919
|
-
}, [pageConfig]);
|
|
3920
3893
|
react.useEffect(() => {
|
|
3921
3894
|
if (!pageConfig?.eventTracking?.length) return;
|
|
3922
3895
|
const sdk = getSDK();
|