handoff-app 1.1.0-experimental.2 → 1.1.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/Changelog.md +0 -5
- package/config/docs/system.md +0 -2
- package/dist/app/components/Component/Cards.jsx +32 -0
- package/dist/app-builder/build.d.ts +1 -6
- package/dist/app-builder/build.js +14 -43
- package/dist/app-builder/index.d.ts +0 -1
- package/dist/app-builder/index.js +1 -9
- package/dist/app-builder/watchers.d.ts +1 -5
- package/dist/app-builder/watchers.js +1 -59
- package/dist/cli.js +1 -1
- package/dist/commands/index.js +2 -16
- package/dist/config/runtime.d.ts +0 -5
- package/dist/config/runtime.js +4 -67
- package/dist/index.d.ts +1 -4
- package/dist/index.js +2 -2
- package/dist/pipeline/index.d.ts +0 -1
- package/dist/pipeline/index.js +1 -3
- package/dist/transformers/plugins/csf-render.js +1 -18
- package/dist/transformers/plugins/ssr-render.js +0 -14
- package/dist/transformers/utils/build.d.ts +0 -18
- package/dist/transformers/utils/build.js +0 -108
- package/dist/types/config.d.ts +0 -19
- package/docs/api.md +279 -0
- package/docs/api_spec.yml +0 -0
- package/docs/cli.md +52 -66
- package/docs/props.md +34 -0
- package/handoff.config.js +1 -1
- package/package.json +6 -10
- package/src/app/components/util/index.ts +11 -64
- package/src/app/next.config.mjs +10 -2
- package/src/app/pages/system/component/[component]/index.tsx +14 -7
- package/src/app/pages/system/component/index.tsx +10 -87
- package/src/app/pages/system/index.tsx +5 -24
- package/src/app/pages/system/tokens/components/[component]/index.tsx +14 -1
- package/src/app/pages/system/tokens/index.tsx +10 -85
- package/src/app/tsconfig.json +1 -1
- package/src/app-builder/README.md +1 -1
- package/src/app-builder/build.ts +16 -59
- package/src/app-builder/index.ts +0 -9
- package/src/app-builder/watchers.ts +0 -59
- package/src/cache/README.md +2 -2
- package/src/cli.ts +1 -1
- package/src/commands/index.ts +0 -14
- package/src/config/runtime.ts +0 -76
- package/src/index.ts +3 -3
- package/src/pipeline/README.md +1 -0
- package/src/pipeline/index.ts +0 -1
- package/src/transformers/README.md +3 -2
- package/src/transformers/plugins/csf-render.ts +0 -17
- package/src/transformers/plugins/ssr-render.ts +8 -17
- package/src/transformers/utils/build.ts +0 -112
- package/src/types/README.md +2 -1
- package/src/types/config.ts +0 -21
- package/tsconfig.json +1 -1
- package/config/docs/playground.md +0 -14
- package/config/docs/system/alert.md +0 -30
- package/config/docs/system/button.md +0 -34
- package/config/docs/system/checkbox.md +0 -30
- package/config/docs/system/input.md +0 -31
- package/config/docs/system/modal.md +0 -32
- package/config/docs/system/pagination.md +0 -30
- package/config/docs/system/radio.md +0 -30
- package/config/docs/system/select.md +0 -30
- package/config/docs/system/switch.md +0 -30
- package/config/docs/system/tooltip.md +0 -30
- package/dist/app/components/Component/Cards.js +0 -17
- package/dist/app-builder/isr-paths.d.ts +0 -44
- package/dist/app-builder/isr-paths.js +0 -213
- package/dist/commands/isr/component.d.ts +0 -10
- package/dist/commands/isr/component.js +0 -63
- package/dist/commands/isr/pages.d.ts +0 -11
- package/dist/commands/isr/pages.js +0 -64
- package/dist/commands/platform/init.d.ts +0 -6
- package/dist/commands/platform/init.js +0 -231
- package/dist/commands/platform/login.d.ts +0 -6
- package/dist/commands/platform/login.js +0 -108
- package/dist/commands/platform/logout.d.ts +0 -6
- package/dist/commands/platform/logout.js +0 -88
- package/dist/commands/platform/pull.d.ts +0 -8
- package/dist/commands/platform/pull.js +0 -112
- package/dist/commands/platform/push.d.ts +0 -8
- package/dist/commands/platform/push.js +0 -428
- package/dist/pipeline/pages.d.ts +0 -6
- package/dist/pipeline/pages.js +0 -21
- package/dist/platform/client.d.ts +0 -122
- package/dist/platform/client.js +0 -228
- package/dist/platform/credentials.d.ts +0 -40
- package/dist/platform/credentials.js +0 -91
- package/dist/platform/sync.d.ts +0 -68
- package/dist/platform/sync.js +0 -349
- package/dist/transformers/preview/page/api.d.ts +0 -8
- package/dist/transformers/preview/page/api.js +0 -74
- package/dist/transformers/preview/page/builder.d.ts +0 -7
- package/dist/transformers/preview/page/builder.js +0 -173
- package/dist/transformers/preview/page/types.d.ts +0 -38
- package/dist/transformers/preview/page/types.js +0 -2
- package/docs/components.md +0 -107
- package/docs/isr.md +0 -113
- package/docs/pages.md +0 -152
- package/docs/rest.yml +0 -590
- package/docs/rest_api.md +0 -78
- package/eslint.config.mjs +0 -18
- package/src/app/components/Page/PageLists.tsx +0 -218
- package/src/app/components/Page/types.ts +0 -19
- package/src/app/components/Playground/ComponentCard.tsx +0 -78
- package/src/app/components/Playground/ComponentLibrary.tsx +0 -99
- package/src/app/components/Playground/EditContext.tsx +0 -159
- package/src/app/components/Playground/EditSheet.tsx +0 -80
- package/src/app/components/Playground/MediaBrowser.tsx +0 -56
- package/src/app/components/Playground/PlaygroundBuilder.tsx +0 -160
- package/src/app/components/Playground/PlaygroundContext.tsx +0 -276
- package/src/app/components/Playground/Preview.tsx +0 -174
- package/src/app/components/Playground/SortableItem.tsx +0 -45
- package/src/app/components/Playground/TemplateManager.tsx +0 -81
- package/src/app/components/Playground/Wizard/ApiKeySettings.tsx +0 -125
- package/src/app/components/Playground/Wizard/WizardDialog.tsx +0 -228
- package/src/app/components/Playground/Wizard/llm-client.ts +0 -87
- package/src/app/components/Playground/Wizard/prompt-builder.ts +0 -78
- package/src/app/components/Playground/Wizard/response-parser.ts +0 -81
- package/src/app/components/Playground/fields/ButtonField.tsx +0 -24
- package/src/app/components/Playground/fields/Field.tsx +0 -112
- package/src/app/components/Playground/fields/FieldLabel.tsx +0 -20
- package/src/app/components/Playground/fields/ImageField.tsx +0 -92
- package/src/app/components/Playground/fields/LinkField.tsx +0 -24
- package/src/app/components/Playground/fields/RichTextField.tsx +0 -34
- package/src/app/components/Playground/fields/TextField.tsx +0 -13
- package/src/app/components/Playground/types.ts +0 -30
- package/src/app/components/ui/dialog.tsx +0 -80
- package/src/app/components/ui/textarea.tsx +0 -19
- package/src/app/pages/playground/index.tsx +0 -30
- package/src/app/pages/system/page/[page]/index.tsx +0 -300
- package/src/app/pages/system/page/index.tsx +0 -124
- package/src/app-builder/isr-paths.ts +0 -209
- package/src/commands/isr/component.ts +0 -68
- package/src/commands/isr/pages.ts +0 -68
- package/src/commands/platform/init.ts +0 -229
- package/src/commands/platform/login.ts +0 -96
- package/src/commands/platform/logout.ts +0 -63
- package/src/commands/platform/pull.ts +0 -98
- package/src/commands/platform/push.ts +0 -469
- package/src/pipeline/pages.ts +0 -10
- package/src/platform/client.ts +0 -335
- package/src/platform/credentials.ts +0 -106
- package/src/platform/sync.ts +0 -428
- package/src/transformers/preview/page/api.ts +0 -65
- package/src/transformers/preview/page/builder.ts +0 -200
- package/src/transformers/preview/page/types.ts +0 -37
- package/test_components/example/example.js +0 -110
- package/test_components/example/style.scss +0 -56
- package/test_components/example/template.hbs +0 -19
- package/test_components/example-csf/example-csf.js +0 -16
- package/test_components/example-csf/style.scss +0 -52
- package/test_components/example-csf/template.stories.tsx +0 -97
- package/test_components/example-react/example-react.js +0 -69
- package/test_components/example-react/style.scss +0 -56
- package/test_components/example-react/template.tsx +0 -49
- package/test_pages/boilerplate/boilerplate.json +0 -73
package/Changelog.md
CHANGED
|
@@ -6,11 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to
|
|
7
7
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
-
## \[1.2.0]
|
|
10
|
-
|
|
11
|
-
* Upgrade to Next16
|
|
12
|
-
* Add pagination data structure to arrays
|
|
13
|
-
|
|
14
9
|
## \[1.1.0] - 2026-03-05
|
|
15
10
|
|
|
16
11
|
This release introduces two major new features. First, handoff now can do automatic
|
package/config/docs/system.md
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lucide_react_1 = require("lucide-react");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const PracticeLine = ({ line, type }) => (<li className="flex items-start gap-3">
|
|
9
|
+
{type === 'positive' ? (<lucide_react_1.Check className="mt-[5px] h-3 w-3 shrink-0 text-emerald-600" strokeWidth={3}/>) : type === 'negative' ? (<lucide_react_1.X className="mt-[5px] h-3 w-3 shrink-0 text-gray-400" strokeWidth={3}/>) : (<span className="mt-[5px] h-3 w-3 shrink-0"/>)}
|
|
10
|
+
<p className="text-sm">{line}</p>
|
|
11
|
+
</li>);
|
|
12
|
+
const CardItem = ({ card }) => {
|
|
13
|
+
// Split content by newlines and render each line as a separate item
|
|
14
|
+
const lines = card.content.split('\n').filter((line) => line.trim());
|
|
15
|
+
return (<ul className="space-y-3 text-emerald-800">
|
|
16
|
+
{lines.map((line, index) => (<PracticeLine line={line} type={card.type} key={`do-rule-${index}`}/>))}
|
|
17
|
+
</ul>);
|
|
18
|
+
};
|
|
19
|
+
const Cards = ({ cards, maxCardsPerRow = 2, className = '' }) => {
|
|
20
|
+
if (!cards || cards.length === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return (<div className="grid grid-cols-[repeat(auto-fit,minmax(100%,1fr))] gap-6 sm:grid-cols-[repeat(auto-fit,minmax(300px,1fr))]">
|
|
24
|
+
{cards.map((card, index) => (<div key={`card-${index}`} className="relative rounded-lg border bg-gray-50 p-8 text-gray-600 dark:bg-gray-800">
|
|
25
|
+
<h2 className="mb-3 font-normal text-gray-700">
|
|
26
|
+
{card.title}
|
|
27
|
+
</h2>
|
|
28
|
+
<CardItem card={card}/>
|
|
29
|
+
</div>))}
|
|
30
|
+
</div>);
|
|
31
|
+
};
|
|
32
|
+
exports.default = Cards;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import Handoff from '..';
|
|
2
2
|
/**
|
|
3
3
|
* Build the Next.js documentation application.
|
|
4
|
-
* @param copyOnlyPaths - If set, do not remove output dir; copy only these paths (relative to out/) into existing output (merge).
|
|
5
|
-
* @param deployDir - If set, copy output to this directory instead of default (workingPath/sitesDirectory/projectId).
|
|
6
4
|
*/
|
|
7
|
-
declare const buildApp: (handoff: Handoff, skipComponents?: boolean
|
|
8
|
-
copyOnlyPaths?: string[];
|
|
9
|
-
deployDir?: string;
|
|
10
|
-
}) => Promise<void>;
|
|
5
|
+
declare const buildApp: (handoff: Handoff, skipComponents?: boolean) => Promise<void>;
|
|
11
6
|
/**
|
|
12
7
|
* Watch the Next.js application.
|
|
13
8
|
* Starts a custom dev server with Handoff-specific watchers and hot-reloading.
|
|
@@ -17,14 +17,12 @@ const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
|
17
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
19
|
const components_1 = require("../pipeline/components");
|
|
20
|
-
const pages_1 = require("../pipeline/pages");
|
|
21
|
-
const builder_1 = __importDefault(require("../transformers/preview/component/builder"));
|
|
22
20
|
const css_1 = require("../transformers/preview/component/css");
|
|
23
21
|
const javascript_1 = require("../transformers/preview/component/javascript");
|
|
22
|
+
const builder_1 = __importDefault(require("../transformers/preview/component/builder"));
|
|
24
23
|
const logger_1 = require("../utils/logger");
|
|
25
24
|
const client_config_1 = require("./client-config");
|
|
26
25
|
const paths_1 = require("./paths");
|
|
27
|
-
const builder_2 = require("../transformers/preview/page/builder");
|
|
28
26
|
const watchers_1 = require("./watchers");
|
|
29
27
|
const websocket_1 = require("./websocket");
|
|
30
28
|
/**
|
|
@@ -83,24 +81,19 @@ const initializeProjectApp = (handoff) => __awaiter(void 0, void 0, void 0, func
|
|
|
83
81
|
});
|
|
84
82
|
/**
|
|
85
83
|
* Build the Next.js documentation application.
|
|
86
|
-
* @param copyOnlyPaths - If set, do not remove output dir; copy only these paths (relative to out/) into existing output (merge).
|
|
87
|
-
* @param deployDir - If set, copy output to this directory instead of default (workingPath/sitesDirectory/projectId).
|
|
88
84
|
*/
|
|
89
|
-
const buildApp = (handoff, skipComponents
|
|
85
|
+
const buildApp = (handoff, skipComponents) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
86
|
skipComponents = skipComponents !== null && skipComponents !== void 0 ? skipComponents : false;
|
|
91
|
-
const copyOnlyPaths = options === null || options === void 0 ? void 0 : options.copyOnlyPaths;
|
|
92
|
-
const deployDir = options === null || options === void 0 ? void 0 : options.deployDir;
|
|
93
87
|
// Perform cleanup
|
|
94
88
|
yield cleanupAppDirectory(handoff);
|
|
95
89
|
// Build components
|
|
96
90
|
if (!skipComponents) {
|
|
97
91
|
yield (0, components_1.buildComponents)(handoff);
|
|
98
92
|
}
|
|
99
|
-
// Build pages (must run after components so rendered outputs exist)
|
|
100
|
-
yield (0, pages_1.buildPages)(handoff);
|
|
101
93
|
// Prepare app
|
|
102
94
|
const appPath = yield initializeProjectApp(handoff);
|
|
103
95
|
yield (0, client_config_1.persistClientConfig)(handoff);
|
|
96
|
+
// Build app
|
|
104
97
|
const buildResult = cross_spawn_1.default.sync('npx', ['next', 'build'], {
|
|
105
98
|
cwd: appPath,
|
|
106
99
|
stdio: 'inherit',
|
|
@@ -113,35 +106,16 @@ const buildApp = (handoff, skipComponents, options) => __awaiter(void 0, void 0,
|
|
|
113
106
|
}
|
|
114
107
|
throw new Error(errorMsg);
|
|
115
108
|
}
|
|
116
|
-
//
|
|
117
|
-
const outputRoot =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const output =
|
|
121
|
-
if (
|
|
122
|
-
yield fs_extra_1.default.
|
|
123
|
-
}
|
|
124
|
-
if (copyOnlyPaths && copyOnlyPaths.length > 0) {
|
|
125
|
-
// Partial deploy: merge only the listed paths into existing output
|
|
126
|
-
yield fs_extra_1.default.ensureDir(output);
|
|
127
|
-
const outDir = path_1.default.resolve(appPath, 'out');
|
|
128
|
-
for (const relativePath of copyOnlyPaths) {
|
|
129
|
-
const src = path_1.default.join(outDir, relativePath);
|
|
130
|
-
const dest = path_1.default.join(output, relativePath);
|
|
131
|
-
if (fs_extra_1.default.existsSync(src)) {
|
|
132
|
-
yield fs_extra_1.default.ensureDir(path_1.default.dirname(dest));
|
|
133
|
-
yield fs_extra_1.default.copy(src, dest, { overwrite: true });
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
// Full deploy: replace output with full out
|
|
139
|
-
if (fs_extra_1.default.existsSync(output)) {
|
|
140
|
-
yield fs_extra_1.default.remove(output);
|
|
141
|
-
}
|
|
142
|
-
yield fs_extra_1.default.ensureDir(output);
|
|
143
|
-
yield fs_extra_1.default.copy(path_1.default.resolve(appPath, 'out'), output);
|
|
109
|
+
// Ensure output root directory exists
|
|
110
|
+
const outputRoot = path_1.default.resolve(handoff.workingPath, handoff.sitesDirectory);
|
|
111
|
+
yield fs_extra_1.default.ensureDir(outputRoot);
|
|
112
|
+
// Clean the project output directory (if exists)
|
|
113
|
+
const output = path_1.default.resolve(outputRoot, handoff.getProjectId());
|
|
114
|
+
if (fs_extra_1.default.existsSync(output)) {
|
|
115
|
+
yield fs_extra_1.default.remove(output);
|
|
144
116
|
}
|
|
117
|
+
// Copy the build files into the project output directory
|
|
118
|
+
yield fs_extra_1.default.copy(path_1.default.resolve(appPath, 'out'), output);
|
|
145
119
|
});
|
|
146
120
|
/**
|
|
147
121
|
* Watch the Next.js application.
|
|
@@ -154,8 +128,6 @@ const watchApp = (handoff) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
154
128
|
yield (0, builder_1.default)(handoff, undefined, undefined, { useCache: true });
|
|
155
129
|
yield (0, javascript_1.buildMainJS)(handoff);
|
|
156
130
|
yield (0, css_1.buildMainCss)(handoff);
|
|
157
|
-
// Build pages after components
|
|
158
|
-
yield (0, builder_2.processPages)(handoff);
|
|
159
131
|
const appPath = yield initializeProjectApp(handoff);
|
|
160
132
|
// Persist client configuration
|
|
161
133
|
yield (0, client_config_1.persistClientConfig)(handoff);
|
|
@@ -170,7 +142,7 @@ const watchApp = (handoff) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
170
142
|
// create empty directory
|
|
171
143
|
yield fs_extra_1.default.ensureDir(moduleOutput);
|
|
172
144
|
}
|
|
173
|
-
const nextProcess = (0, cross_spawn_1.default)('npx', ['next', 'dev', '--port', String(port)], {
|
|
145
|
+
const nextProcess = (0, cross_spawn_1.default)('npx', ['next', 'dev', '--turbopack', '--port', String(port)], {
|
|
174
146
|
cwd: appPath,
|
|
175
147
|
stdio: 'inherit',
|
|
176
148
|
env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'development' }),
|
|
@@ -200,7 +172,6 @@ const watchApp = (handoff) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
200
172
|
(0, watchers_1.watchRuntimeConfiguration)(handoff, state);
|
|
201
173
|
(0, watchers_1.watchGlobalEntries)(handoff, state, chokidarConfig);
|
|
202
174
|
(0, watchers_1.watchPages)(handoff, chokidarConfig);
|
|
203
|
-
(0, watchers_1.watchRuntimePages)(handoff, state);
|
|
204
175
|
});
|
|
205
176
|
exports.watchApp = watchApp;
|
|
206
177
|
/**
|
|
@@ -219,7 +190,7 @@ const devApp = (handoff) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
219
190
|
// Persist client configuration
|
|
220
191
|
yield (0, client_config_1.persistClientConfig)(handoff);
|
|
221
192
|
// Run
|
|
222
|
-
const devResult = cross_spawn_1.default.sync('npx', ['next', 'dev', '--port', String((_b = (_a = handoff.config.app.ports) === null || _a === void 0 ? void 0 : _a.app) !== null && _b !== void 0 ? _b : 3000)], {
|
|
193
|
+
const devResult = cross_spawn_1.default.sync('npx', ['next', 'dev', '--turbopack', '--port', String((_b = (_a = handoff.config.app.ports) === null || _a === void 0 ? void 0 : _a.app) !== null && _b !== void 0 ? _b : 3000)], {
|
|
223
194
|
cwd: appPath,
|
|
224
195
|
stdio: 'inherit',
|
|
225
196
|
env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'development' }),
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { buildComponents } from '../pipeline/components';
|
|
2
2
|
export { default, devApp, watchApp } from './build';
|
|
3
|
-
export { getL1StaticPathSegments, getL2StaticPathSegments, normalizeRoutePath, resolveAffectedOutputPaths, resolveComponentAffectedOutputPaths, resolveComponentAffectedOutputPathsBatch, routePathToOutputPaths, } from './isr-paths';
|
|
@@ -3,18 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.watchApp = exports.devApp = exports.default = exports.buildComponents = void 0;
|
|
7
7
|
var components_1 = require("../pipeline/components");
|
|
8
8
|
Object.defineProperty(exports, "buildComponents", { enumerable: true, get: function () { return components_1.buildComponents; } });
|
|
9
9
|
var build_1 = require("./build");
|
|
10
10
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(build_1).default; } });
|
|
11
11
|
Object.defineProperty(exports, "devApp", { enumerable: true, get: function () { return build_1.devApp; } });
|
|
12
12
|
Object.defineProperty(exports, "watchApp", { enumerable: true, get: function () { return build_1.watchApp; } });
|
|
13
|
-
var isr_paths_1 = require("./isr-paths");
|
|
14
|
-
Object.defineProperty(exports, "getL1StaticPathSegments", { enumerable: true, get: function () { return isr_paths_1.getL1StaticPathSegments; } });
|
|
15
|
-
Object.defineProperty(exports, "getL2StaticPathSegments", { enumerable: true, get: function () { return isr_paths_1.getL2StaticPathSegments; } });
|
|
16
|
-
Object.defineProperty(exports, "normalizeRoutePath", { enumerable: true, get: function () { return isr_paths_1.normalizeRoutePath; } });
|
|
17
|
-
Object.defineProperty(exports, "resolveAffectedOutputPaths", { enumerable: true, get: function () { return isr_paths_1.resolveAffectedOutputPaths; } });
|
|
18
|
-
Object.defineProperty(exports, "resolveComponentAffectedOutputPaths", { enumerable: true, get: function () { return isr_paths_1.resolveComponentAffectedOutputPaths; } });
|
|
19
|
-
Object.defineProperty(exports, "resolveComponentAffectedOutputPathsBatch", { enumerable: true, get: function () { return isr_paths_1.resolveComponentAffectedOutputPathsBatch; } });
|
|
20
|
-
Object.defineProperty(exports, "routePathToOutputPaths", { enumerable: true, get: function () { return isr_paths_1.routePathToOutputPaths; } });
|
|
@@ -34,15 +34,11 @@ export declare const mapEntryTypeToSegment: (type: keyof ComponentListObject["en
|
|
|
34
34
|
*
|
|
35
35
|
* @returns A Map of paths to watch and their entry types
|
|
36
36
|
*/
|
|
37
|
-
export declare const getRuntimeComponentsPathsToWatch: (handoff: Handoff) => Map<string, "
|
|
37
|
+
export declare const getRuntimeComponentsPathsToWatch: (handoff: Handoff) => Map<string, "template" | "js" | "scss">;
|
|
38
38
|
/**
|
|
39
39
|
* Watches runtime components for changes.
|
|
40
40
|
*/
|
|
41
41
|
export declare const watchRuntimeComponents: (handoff: Handoff, state: WatcherState, runtimeComponentPathsToWatch: Map<string, keyof ComponentListObject["entries"]>) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Watches runtime page config files for changes and triggers page rebuilds.
|
|
44
|
-
*/
|
|
45
|
-
export declare const watchRuntimePages: (handoff: Handoff, state: WatcherState) => void;
|
|
46
42
|
/**
|
|
47
43
|
* Watches the runtime configuration for changes.
|
|
48
44
|
*/
|
|
@@ -35,14 +35,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.watchRuntimeConfiguration = exports.
|
|
38
|
+
exports.watchRuntimeConfiguration = exports.watchRuntimeComponents = exports.getRuntimeComponentsPathsToWatch = exports.mapEntryTypeToSegment = exports.watchGlobalEntries = exports.watchPages = exports.watchAppSource = exports.watchPublicDirectory = void 0;
|
|
39
39
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
40
40
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
41
41
|
const path_1 = __importDefault(require("path"));
|
|
42
42
|
const css_1 = require("../transformers/preview/component/css");
|
|
43
43
|
const javascript_1 = require("../transformers/preview/component/javascript");
|
|
44
44
|
const builder_1 = __importStar(require("../transformers/preview/component/builder"));
|
|
45
|
-
const builder_2 = require("../transformers/preview/page/builder");
|
|
46
45
|
const logger_1 = require("../utils/logger");
|
|
47
46
|
const client_config_1 = require("./client-config");
|
|
48
47
|
const paths_1 = require("./paths");
|
|
@@ -261,63 +260,6 @@ const watchRuntimeComponents = (handoff, state, runtimeComponentPathsToWatch) =>
|
|
|
261
260
|
}
|
|
262
261
|
};
|
|
263
262
|
exports.watchRuntimeComponents = watchRuntimeComponents;
|
|
264
|
-
/**
|
|
265
|
-
* Watches runtime page config files for changes and triggers page rebuilds.
|
|
266
|
-
*/
|
|
267
|
-
const watchRuntimePages = (handoff, state) => {
|
|
268
|
-
var _a, _b, _c, _d, _e;
|
|
269
|
-
const runtimePages = (_c = (_b = (_a = handoff.runtimeConfig) === null || _a === void 0 ? void 0 : _a.entries) === null || _b === void 0 ? void 0 : _b.pages) !== null && _c !== void 0 ? _c : {};
|
|
270
|
-
const pageConfigPaths = handoff.getConfigFilePaths().filter((configPath) => {
|
|
271
|
-
const dirName = path_1.default.basename(path_1.default.dirname(configPath));
|
|
272
|
-
return dirName in runtimePages;
|
|
273
|
-
});
|
|
274
|
-
// Also watch page directories directly
|
|
275
|
-
const pageIds = Object.keys(runtimePages);
|
|
276
|
-
if (pageIds.length === 0 && pageConfigPaths.length === 0)
|
|
277
|
-
return;
|
|
278
|
-
const pathsToWatch = pageConfigPaths.length > 0 ? pageConfigPaths : [];
|
|
279
|
-
// Add page config entry paths from the config
|
|
280
|
-
for (const pageId of pageIds) {
|
|
281
|
-
const page = runtimePages[pageId];
|
|
282
|
-
if (page.path && fs_extra_1.default.existsSync(page.path)) {
|
|
283
|
-
pathsToWatch.push(page.path);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
// Watch the page entry directories from config
|
|
287
|
-
if ((_e = (_d = handoff.config.entries) === null || _d === void 0 ? void 0 : _d.pages) === null || _e === void 0 ? void 0 : _e.length) {
|
|
288
|
-
for (const pagePath of handoff.config.entries.pages) {
|
|
289
|
-
const resolvedPath = path_1.default.resolve(handoff.workingPath, pagePath);
|
|
290
|
-
if (fs_extra_1.default.existsSync(resolvedPath)) {
|
|
291
|
-
pathsToWatch.push(resolvedPath);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (pathsToWatch.length === 0)
|
|
296
|
-
return;
|
|
297
|
-
chokidar_1.default.watch(pathsToWatch, { ignoreInitial: true }).on('all', (event, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
298
|
-
switch (event) {
|
|
299
|
-
case 'add':
|
|
300
|
-
case 'change':
|
|
301
|
-
case 'unlink':
|
|
302
|
-
if (!state.debounce) {
|
|
303
|
-
state.debounce = true;
|
|
304
|
-
try {
|
|
305
|
-
logger_1.Logger.warn('Page config changed. Rebuilding pages...');
|
|
306
|
-
handoff.reload();
|
|
307
|
-
yield (0, builder_2.processPages)(handoff);
|
|
308
|
-
}
|
|
309
|
-
catch (e) {
|
|
310
|
-
logger_1.Logger.error('Error processing pages:', e);
|
|
311
|
-
}
|
|
312
|
-
finally {
|
|
313
|
-
state.debounce = false;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
}));
|
|
319
|
-
};
|
|
320
|
-
exports.watchRuntimePages = watchRuntimePages;
|
|
321
263
|
/**
|
|
322
264
|
* Watches the runtime configuration for changes.
|
|
323
265
|
*/
|
package/dist/cli.js
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -12,16 +12,9 @@ const pages_1 = __importDefault(require("./eject/pages"));
|
|
|
12
12
|
const theme_1 = __importDefault(require("./eject/theme"));
|
|
13
13
|
const fetch_1 = __importDefault(require("./fetch"));
|
|
14
14
|
const init_1 = __importDefault(require("./init"));
|
|
15
|
-
const component_1 = __importDefault(require("./
|
|
16
|
-
const pages_2 = __importDefault(require("./isr/pages"));
|
|
17
|
-
const component_2 = __importDefault(require("./make/component"));
|
|
15
|
+
const component_1 = __importDefault(require("./make/component"));
|
|
18
16
|
const page_1 = __importDefault(require("./make/page"));
|
|
19
17
|
const template_1 = __importDefault(require("./make/template"));
|
|
20
|
-
const init_2 = __importDefault(require("./platform/init"));
|
|
21
|
-
const login_1 = __importDefault(require("./platform/login"));
|
|
22
|
-
const logout_1 = __importDefault(require("./platform/logout"));
|
|
23
|
-
const pull_1 = __importDefault(require("./platform/pull"));
|
|
24
|
-
const push_1 = __importDefault(require("./platform/push"));
|
|
25
18
|
const scaffold_1 = __importDefault(require("./scaffold"));
|
|
26
19
|
const start_1 = __importDefault(require("./start"));
|
|
27
20
|
const components_2 = __importDefault(require("./validate/components"));
|
|
@@ -34,16 +27,9 @@ exports.commands = [
|
|
|
34
27
|
theme_1.default,
|
|
35
28
|
fetch_1.default,
|
|
36
29
|
init_1.default,
|
|
37
|
-
pages_2.default,
|
|
38
|
-
component_1.default,
|
|
39
30
|
page_1.default,
|
|
40
|
-
|
|
31
|
+
component_1.default,
|
|
41
32
|
template_1.default,
|
|
42
|
-
login_1.default,
|
|
43
|
-
init_2.default,
|
|
44
|
-
pull_1.default,
|
|
45
|
-
push_1.default,
|
|
46
|
-
logout_1.default,
|
|
47
33
|
scaffold_1.default,
|
|
48
34
|
start_1.default,
|
|
49
35
|
components_2.default,
|
package/dist/config/runtime.d.ts
CHANGED
|
@@ -29,11 +29,6 @@ export declare const initRuntimeConfig: (handoff: HandoffContext) => [runtimeCon
|
|
|
29
29
|
* @returns An array of string paths to component directories.
|
|
30
30
|
*/
|
|
31
31
|
export declare const getComponentsForPath: (searchPath: string) => string[];
|
|
32
|
-
/**
|
|
33
|
-
* Returns a list of page directories for a given path.
|
|
34
|
-
* Mirrors getComponentsForPath but for page definitions.
|
|
35
|
-
*/
|
|
36
|
-
export declare const getPagesForPath: (searchPath: string) => string[];
|
|
37
32
|
/**
|
|
38
33
|
* Recursively converts all keys and string values in an object to lowercase.
|
|
39
34
|
*/
|
package/dist/config/runtime.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toLowerCaseKeysAndValues = exports.
|
|
6
|
+
exports.toLowerCaseKeysAndValues = exports.getComponentsForPath = exports.initRuntimeConfig = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const logger_1 = require("../utils/logger");
|
|
@@ -15,8 +15,8 @@ const logger_1 = require("../utils/logger");
|
|
|
15
15
|
* @returns A tuple of [RuntimeConfig, configFilePaths].
|
|
16
16
|
*/
|
|
17
17
|
const initRuntimeConfig = (handoff) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
19
|
-
var
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
+
var _j;
|
|
20
20
|
const configFiles = [];
|
|
21
21
|
const result = {
|
|
22
22
|
options: {},
|
|
@@ -24,7 +24,6 @@ const initRuntimeConfig = (handoff) => {
|
|
|
24
24
|
scss: undefined,
|
|
25
25
|
js: undefined,
|
|
26
26
|
components: {},
|
|
27
|
-
pages: {},
|
|
28
27
|
},
|
|
29
28
|
};
|
|
30
29
|
if (!!((_a = handoff.config.entries) === null || _a === void 0 ? void 0 : _a.scss)) {
|
|
@@ -77,7 +76,7 @@ const initRuntimeConfig = (handoff) => {
|
|
|
77
76
|
component.options || (component.options = {
|
|
78
77
|
transformer: { defaults: {}, replace: {} },
|
|
79
78
|
});
|
|
80
|
-
(
|
|
79
|
+
(_j = component.options).transformer || (_j.transformer = { defaults: {}, replace: {} });
|
|
81
80
|
const transformer = component.options.transformer;
|
|
82
81
|
(_g = transformer.cssRootClass) !== null && _g !== void 0 ? _g : (transformer.cssRootClass = null);
|
|
83
82
|
(_h = transformer.tokenNameSegments) !== null && _h !== void 0 ? _h : (transformer.tokenNameSegments = null);
|
|
@@ -90,47 +89,6 @@ const initRuntimeConfig = (handoff) => {
|
|
|
90
89
|
result.entries.components[component.id] = component;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
if ((_k = (_j = handoff.config.entries) === null || _j === void 0 ? void 0 : _j.pages) === null || _k === void 0 ? void 0 : _k.length) {
|
|
94
|
-
const pagePaths = handoff.config.entries.pages.flatMap(exports.getPagesForPath);
|
|
95
|
-
for (const pagePath of pagePaths) {
|
|
96
|
-
const resolvedPagePath = path_1.default.resolve(handoff.workingPath, pagePath);
|
|
97
|
-
const pageBaseName = path_1.default.basename(resolvedPagePath);
|
|
98
|
-
const possibleConfigFiles = [`${pageBaseName}.json`, `${pageBaseName}.js`, `${pageBaseName}.cjs`];
|
|
99
|
-
const configFileName = possibleConfigFiles.find((file) => fs_extra_1.default.existsSync(path_1.default.resolve(resolvedPagePath, file)));
|
|
100
|
-
if (!configFileName) {
|
|
101
|
-
logger_1.Logger.warn(`Missing page config: ${path_1.default.resolve(resolvedPagePath, possibleConfigFiles.join(' or '))}`);
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const resolvedPageConfigPath = path_1.default.resolve(resolvedPagePath, configFileName);
|
|
105
|
-
configFiles.push(resolvedPageConfigPath);
|
|
106
|
-
let page;
|
|
107
|
-
try {
|
|
108
|
-
if (configFileName.endsWith('.json')) {
|
|
109
|
-
const pageJson = fs_extra_1.default.readFileSync(resolvedPageConfigPath, 'utf8');
|
|
110
|
-
page = JSON.parse(pageJson);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
delete require.cache[require.resolve(resolvedPageConfigPath)];
|
|
114
|
-
const importedPage = require(resolvedPageConfigPath);
|
|
115
|
-
page = importedPage.default || importedPage;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
logger_1.Logger.error(`Failed to read or parse page config: ${resolvedPageConfigPath}`, err);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
page.id = pageBaseName;
|
|
123
|
-
// Validate that referenced components exist
|
|
124
|
-
if (page.components) {
|
|
125
|
-
for (const componentId of page.components) {
|
|
126
|
-
if (!result.entries.components[componentId]) {
|
|
127
|
-
logger_1.Logger.warn(`Page '${page.id}' references unknown component '${componentId}'`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
result.entries.pages[page.id] = page;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
92
|
return [result, Array.from(configFiles)];
|
|
135
93
|
};
|
|
136
94
|
exports.initRuntimeConfig = initRuntimeConfig;
|
|
@@ -170,27 +128,6 @@ const getComponentsForPath = (searchPath) => {
|
|
|
170
128
|
return [searchPath];
|
|
171
129
|
};
|
|
172
130
|
exports.getComponentsForPath = getComponentsForPath;
|
|
173
|
-
/**
|
|
174
|
-
* Returns a list of page directories for a given path.
|
|
175
|
-
* Mirrors getComponentsForPath but for page definitions.
|
|
176
|
-
*/
|
|
177
|
-
const getPagesForPath = (searchPath) => {
|
|
178
|
-
const dirName = path_1.default.basename(searchPath);
|
|
179
|
-
const possibleConfigFiles = [`${dirName}.json`, `${dirName}.js`, `${dirName}.cjs`];
|
|
180
|
-
const hasOwnConfig = possibleConfigFiles.some((file) => fs_extra_1.default.existsSync(path_1.default.resolve(searchPath, file)));
|
|
181
|
-
if (hasOwnConfig) {
|
|
182
|
-
return [searchPath];
|
|
183
|
-
}
|
|
184
|
-
const subdirectories = fs_extra_1.default
|
|
185
|
-
.readdirSync(searchPath, { withFileTypes: true })
|
|
186
|
-
.filter((entry) => entry.isDirectory())
|
|
187
|
-
.map((entry) => entry.name);
|
|
188
|
-
if (subdirectories.length > 0) {
|
|
189
|
-
return subdirectories.map((subdir) => path_1.default.join(searchPath, subdir));
|
|
190
|
-
}
|
|
191
|
-
return [searchPath];
|
|
192
|
-
};
|
|
193
|
-
exports.getPagesForPath = getPagesForPath;
|
|
194
131
|
/**
|
|
195
132
|
* Recursively converts all keys and string values in an object to lowercase.
|
|
196
133
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -26,10 +26,7 @@ declare class Handoff {
|
|
|
26
26
|
preRunner(validate?: boolean): Handoff;
|
|
27
27
|
fetch(): Promise<Handoff>;
|
|
28
28
|
component(name: string | null): Promise<Handoff>;
|
|
29
|
-
build(skipComponents?: boolean
|
|
30
|
-
copyOnlyPaths?: string[];
|
|
31
|
-
deployDir?: string;
|
|
32
|
-
}): Promise<Handoff>;
|
|
29
|
+
build(skipComponents?: boolean): Promise<Handoff>;
|
|
33
30
|
ejectConfig(): Promise<Handoff>;
|
|
34
31
|
ejectPages(): Promise<Handoff>;
|
|
35
32
|
ejectTheme(): Promise<Handoff>;
|
package/dist/index.js
CHANGED
|
@@ -114,10 +114,10 @@ class Handoff {
|
|
|
114
114
|
return this;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
build(skipComponents
|
|
117
|
+
build(skipComponents) {
|
|
118
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
119
|
this.preRunner();
|
|
120
|
-
yield (0, app_builder_1.default)(this, skipComponents
|
|
120
|
+
yield (0, app_builder_1.default)(this, skipComponents);
|
|
121
121
|
return this;
|
|
122
122
|
});
|
|
123
123
|
}
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import 'dotenv/config';
|
|
|
2
2
|
import Handoff from '..';
|
|
3
3
|
export { readPrevJSONFile, zip, zipAssets } from './archive';
|
|
4
4
|
export { buildComponents } from './components';
|
|
5
|
-
export { buildPages } from './pages';
|
|
6
5
|
/**
|
|
7
6
|
* Run the entire Figma data pipeline:
|
|
8
7
|
* 1. Validate runtime requirements
|
package/dist/pipeline/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.buildComponents = exports.zipAssets = exports.zip = exports.readPrevJSONFile = void 0;
|
|
16
16
|
require("dotenv/config");
|
|
17
17
|
const app_builder_1 = __importDefault(require("../app-builder"));
|
|
18
18
|
const logger_1 = require("../utils/logger");
|
|
@@ -26,8 +26,6 @@ Object.defineProperty(exports, "zip", { enumerable: true, get: function () { ret
|
|
|
26
26
|
Object.defineProperty(exports, "zipAssets", { enumerable: true, get: function () { return archive_1.zipAssets; } });
|
|
27
27
|
var components_1 = require("./components");
|
|
28
28
|
Object.defineProperty(exports, "buildComponents", { enumerable: true, get: function () { return components_1.buildComponents; } });
|
|
29
|
-
var pages_1 = require("./pages");
|
|
30
|
-
Object.defineProperty(exports, "buildPages", { enumerable: true, get: function () { return pages_1.buildPages; } });
|
|
31
29
|
/**
|
|
32
30
|
* Run the entire Figma data pipeline:
|
|
33
31
|
* 1. Validate runtime requirements
|
|
@@ -20,7 +20,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
20
20
|
const server_1 = __importDefault(require("react-dom/server"));
|
|
21
21
|
const logger_1 = require("../../utils/logger");
|
|
22
22
|
const component_1 = require("../preview/component");
|
|
23
|
-
const build_1 = require("../utils/build");
|
|
24
23
|
const html_1 = require("../utils/html");
|
|
25
24
|
const module_1 = require("../utils/module");
|
|
26
25
|
const schema_1 = require("../utils/schema");
|
|
@@ -154,7 +153,7 @@ function csfRenderPlugin(componentData, _documentationComponents, handoff) {
|
|
|
154
153
|
},
|
|
155
154
|
generateBundle(_, bundle) {
|
|
156
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
var _a, _b, _c, _d, _e
|
|
156
|
+
var _a, _b, _c, _d, _e;
|
|
158
157
|
for (const [fileName, chunkInfo] of Object.entries(bundle)) {
|
|
159
158
|
if (chunkInfo.type === 'chunk' && fileName.includes(PLUGIN_CONSTANTS.SCRIPT_ID)) {
|
|
160
159
|
delete bundle[fileName];
|
|
@@ -261,22 +260,6 @@ function csfRenderPlugin(componentData, _documentationComponents, handoff) {
|
|
|
261
260
|
preview.url = fileName;
|
|
262
261
|
lastHtml = html;
|
|
263
262
|
}
|
|
264
|
-
// Emit standalone client module for Playground live rendering
|
|
265
|
-
const firstStoryKey = (_f = stories[0]) === null || _f === void 0 ? void 0 : _f[0];
|
|
266
|
-
if (firstStoryKey) {
|
|
267
|
-
try {
|
|
268
|
-
const clientModuleSource = (0, build_1.generateCsfClientComponentSource)(templatePath, firstStoryKey);
|
|
269
|
-
const clientModuleJs = yield (0, build_1.buildClientModule)(clientModuleSource, handoff);
|
|
270
|
-
this.emitFile({
|
|
271
|
-
type: 'asset',
|
|
272
|
-
fileName: `${componentId}.module.js`,
|
|
273
|
-
source: clientModuleJs,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
logger_1.Logger.warn(`Failed to build client module for ${componentId}: ${error}`);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
263
|
componentData.format = 'react';
|
|
281
264
|
componentData.preview = '';
|
|
282
265
|
componentData.code = (0, html_1.trimPreview)(sourceCode);
|
|
@@ -257,20 +257,6 @@ function ssrRenderPlugin(componentData, documentationComponents, handoff) {
|
|
|
257
257
|
generatedPreviews[previewKey] = finalHtml;
|
|
258
258
|
componentData.previews[previewKey].url = `${componentId}-${previewKey}.html`;
|
|
259
259
|
}
|
|
260
|
-
// Emit standalone client module for Playground live rendering
|
|
261
|
-
console.log('Emmiting Module componentPath', componentId, componentPath);
|
|
262
|
-
try {
|
|
263
|
-
const clientModuleSource = (0, build_1.generateClientComponentSource)(componentPath);
|
|
264
|
-
const clientModuleJs = yield (0, build_1.buildClientModule)(clientModuleSource, handoff);
|
|
265
|
-
this.emitFile({
|
|
266
|
-
type: 'asset',
|
|
267
|
-
fileName: `${componentId}.module.js`,
|
|
268
|
-
source: clientModuleJs,
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
logger_1.Logger.warn(`Failed to build client module for ${componentId}: ${error}`);
|
|
273
|
-
}
|
|
274
260
|
// Format final HTML and update component data
|
|
275
261
|
finalHtml = yield (0, html_1.formatHtml)(finalHtml);
|
|
276
262
|
componentData.format = 'react';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import esbuild from 'esbuild';
|
|
2
|
-
import Handoff from '../../index';
|
|
3
2
|
/**
|
|
4
3
|
* Default esbuild configuration for SSR builds
|
|
5
4
|
*/
|
|
@@ -26,20 +25,3 @@ export declare function createReactResolvePlugin(workingPath: string, handoffMod
|
|
|
26
25
|
name: string;
|
|
27
26
|
setup(build: any): void;
|
|
28
27
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Generates the entry source for a standalone client-side React component module.
|
|
31
|
-
* The resulting module exports `render(container, props)` and `update(props)`
|
|
32
|
-
* so the Playground can dynamically load and re-render it in an iframe.
|
|
33
|
-
*/
|
|
34
|
-
export declare function generateClientComponentSource(componentPath: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Generates the entry source for a standalone CSF component module.
|
|
37
|
-
* Replicates the story rendering logic (meta.render / story.render / meta.component)
|
|
38
|
-
* so the Playground can render CSF components client-side.
|
|
39
|
-
*/
|
|
40
|
-
export declare function generateCsfClientComponentSource(componentPath: string, storyKey: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Builds a self-contained browser ESM module from the given source code.
|
|
43
|
-
* React and ReactDOM are bundled into the output so the module works standalone.
|
|
44
|
-
*/
|
|
45
|
-
export declare function buildClientModule(sourceCode: string, handoff: Handoff): Promise<string>;
|