handoff-app 2.0.0-8 → 2.0.0-9
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 +19 -3
- package/dist/catalog/normalize.js +3 -0
- package/dist/catalog/previews.js +5 -4
- package/dist/catalog/types.d.ts +8 -0
- package/dist/config/loader.js +2 -0
- package/dist/config/runtime.js +8 -10
- package/dist/handlebars.d.ts +10 -2
- package/dist/transformers/plugins/ssr-render.js +40 -15
- package/dist/transformers/preview/component/css.d.ts +1 -0
- package/dist/transformers/preview/component/css.js +85 -47
- package/dist/transformers/preview/pattern/html.js +3 -1
- package/dist/transformers/preview/types.d.ts +13 -0
- package/dist/transformers/utils/build.d.ts +19 -0
- package/dist/transformers/utils/build.js +83 -1
- package/dist/transformers/utils/module.js +2 -1
- package/dist/types/config.d.ts +6 -0
- package/package.json +1 -1
- package/src/app/components/Component/PageSliceResolver.tsx +1 -0
- package/src/app/components/Component/Preview.tsx +380 -189
- package/src/app/components/Component/slices/ComponentDisplaySlice.tsx +4 -0
- package/src/catalog/README.md +3 -0
- package/src/catalog/normalize.ts +2 -0
- package/src/catalog/previews.ts +6 -3
- package/src/catalog/types.ts +8 -0
- package/src/config/loader.ts +2 -0
- package/src/config/runtime.ts +9 -4
- package/src/handlebars.ts +8 -2
- package/src/transformers/plugins/ssr-render.ts +53 -16
- package/src/transformers/preview/component/css.ts +93 -50
- package/src/transformers/preview/pattern/html.ts +3 -1
- package/src/transformers/preview/types.ts +14 -0
- package/src/transformers/utils/build.ts +80 -0
- package/src/transformers/utils/module.ts +4 -2
- package/src/types/config.ts +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import esbuild from 'esbuild';
|
|
2
2
|
import { ModuleEvaluationResult } from '../types';
|
|
3
|
-
import { DEFAULT_SSR_BUILD_CONFIG } from './build';
|
|
3
|
+
import { DEFAULT_SSR_BUILD_CONFIG, withStyleLoaders } from './build';
|
|
4
4
|
|
|
5
5
|
function createModuleBuildConfig(entryPath: string, handoff: any): esbuild.BuildOptions {
|
|
6
6
|
const defaultBuildConfig: esbuild.BuildOptions = {
|
|
@@ -8,9 +8,11 @@ function createModuleBuildConfig(entryPath: string, handoff: any): esbuild.Build
|
|
|
8
8
|
entryPoints: [entryPath],
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const hookedBuildConfig = handoff.config?.hooks?.ssrBuildConfig
|
|
12
12
|
? handoff.config.hooks.ssrBuildConfig(defaultBuildConfig)
|
|
13
13
|
: defaultBuildConfig;
|
|
14
|
+
|
|
15
|
+
return withStyleLoaders(hookedBuildConfig);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
function evaluateBuiltModule(code: string): ModuleEvaluationResult {
|
package/src/types/config.ts
CHANGED
|
@@ -275,6 +275,9 @@ export interface Config {
|
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Optional hook to override the SSR build configuration used in the ssrRenderPlugin
|
|
278
|
+
*
|
|
279
|
+
* Stylesheet loaders are re-applied after this hook, so a `.css`/`.scss`/`.sass` import stays out
|
|
280
|
+
* of the JavaScript graph whatever the hook returns.
|
|
278
281
|
* @param config - The default esbuild configuration
|
|
279
282
|
* @returns Modified esbuild configuration
|
|
280
283
|
* @example
|
|
@@ -289,6 +292,9 @@ export interface Config {
|
|
|
289
292
|
|
|
290
293
|
/**
|
|
291
294
|
* Optional hook to override the client-side build configuration used in the ssrRenderPlugin
|
|
295
|
+
*
|
|
296
|
+
* Stylesheet loaders are re-applied after this hook, so a `.css`/`.scss`/`.sass` import stays out
|
|
297
|
+
* of the JavaScript graph whatever the hook returns.
|
|
292
298
|
* @param config - The default esbuild configuration
|
|
293
299
|
* @returns Modified esbuild configuration
|
|
294
300
|
* @example
|