Skip to content

Commit 8c4e554

Browse files
authored
fix: starter's root.tsx and global styles (#590)
1 parent f5122f4 commit 8c4e554

File tree

25 files changed

+80
-27
lines changed

25 files changed

+80
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "qwik-monorepo",
4-
"version": "0.0.24",
4+
"version": "0.0.25",
55
"scripts": {
66
"build": "yarn node scripts --tsc --build --api --platform-binding-wasm-copy",
77
"build.full": "yarn node scripts --tsc --build --api --eslint --qwikcity --platform-binding --wasm",

packages/create-qwik/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-qwik",
3-
"version": "0.0.24",
3+
"version": "0.0.25",
44
"description": "Interactive CLI and API for generating Qwik projects.",
55
"bin": "create-qwik",
66
"main": "index.js",

packages/eslint-plugin-qwik/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-qwik",
3-
"version": "0.0.24",
3+
"version": "0.0.25",
44
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
55
"main": "index.js",
66
"author": "Builder Team",

packages/qwik/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@builder.io/qwik",
3-
"version": "0.0.24",
3+
"version": "0.0.25",
44
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
55
"main": "./dist/core.cjs",
66
"module": "./dist/core.mjs",

packages/qwik/src/optimizer/src/plugins/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) {
158158
opts.input = [path.resolve(srcDir, 'entry.ssr.tsx')];
159159
} else {
160160
// client input default
161-
opts.input = [path.resolve(srcDir, 'components', 'app', 'app.tsx')];
161+
opts.input = [path.resolve(srcDir, 'root.tsx')];
162162
}
163163
}
164164
opts.input = opts.input.map((input) => {

packages/qwik/src/optimizer/src/plugins/plugin.unit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('qwik plugin', () => {
1515
expect(opts.forceFullBuild).toBe(false);
1616
expect(opts.debug).toBe(false);
1717
expect(opts.rootDir).toBe(cwd);
18-
expect(opts.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
18+
expect(opts.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
1919
expect(opts.outDir).toBe(resolve(cwd, 'dist'));
2020
expect(opts.manifestInput).toBe(null);
2121
expect(opts.manifestOutput).toBe(null);
@@ -32,7 +32,7 @@ describe('qwik plugin', () => {
3232
expect(opts.forceFullBuild).toBe(true);
3333
expect(opts.debug).toBe(false);
3434
expect(opts.rootDir).toBe(cwd);
35-
expect(opts.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
35+
expect(opts.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
3636
expect(opts.outDir).toBe(resolve(cwd, 'dist'));
3737
expect(opts.manifestInput).toBe(null);
3838
expect(opts.manifestOutput).toBe(null);

packages/qwik/src/optimizer/src/plugins/rollup.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('rollup plugin', () => {
1919
const rollupInputOpts: InputOptions = await plugin.options!({});
2020

2121
expect(typeof rollupInputOpts.onwarn).toBe('function');
22-
expect(rollupInputOpts.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
22+
expect(rollupInputOpts.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
2323
});
2424

2525
it('rollup default input options, ssr', async () => {

packages/qwik/src/optimizer/src/plugins/vite.unit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('vite plugin', () => {
5959

6060
expect(plugin.enforce).toBe('pre');
6161
expect(build.outDir).toBe(resolve(cwd, 'dist'));
62-
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
62+
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
6363
expect(outputOptions.assetFileNames).toBe('build/[name].[ext]');
6464
expect(outputOptions.chunkFileNames).toBe('build/[name].js');
6565
expect(outputOptions.entryFileNames).toBe('build/[name].js');
@@ -87,7 +87,7 @@ describe('vite plugin', () => {
8787

8888
expect(plugin.enforce).toBe('pre');
8989
expect(build.outDir).toBe(resolve(cwd, 'dist'));
90-
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
90+
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
9191
expect(outputOptions.assetFileNames).toBe('build/q-[hash].[ext]');
9292
expect(outputOptions.chunkFileNames).toBe('build/q-[hash].js');
9393
expect(outputOptions.entryFileNames).toBe('build/q-[hash].js');
@@ -113,7 +113,7 @@ describe('vite plugin', () => {
113113

114114
expect(opts.target).toBe('client');
115115
expect(opts.buildMode).toBe('production');
116-
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'components', 'app', 'app.tsx')]);
116+
expect(rollupOptions.input).toEqual([resolve(cwd, 'src', 'root.tsx')]);
117117
expect(build.outDir).toEqual(resolve(cwd, 'client-dist'));
118118
});
119119

packages/qwik/src/server/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function serializeDocument(docOrEl: Document | Element, opts?: SerializeD
160160
// Warning: (ae-forgotten-export) The symbol "SymbolMapper" needs to be exported by the entry point index.d.ts
161161
//
162162
// @public
163-
export function setServerPlatform(document: any, opts: SerializeDocumentOptions, mapper: SymbolMapper): Promise<void>;
163+
export function setServerPlatform(document: any, opts: SerializeDocumentOptions, mapper: SymbolMapper | undefined): Promise<void>;
164164

165165
// @public (undocumented)
166166
export interface SnapshotResult {

packages/qwik/src/server/platform.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import type { CorePlatform } from '@builder.io/qwik';
22
import { setPlatform } from '@builder.io/qwik';
33
import { getSymbolHash } from '../core/import/qrl-class';
4+
import { logError } from '../core/util/log';
45
import type { SymbolMapper } from '../optimizer/src/types';
56
import type { SerializeDocumentOptions } from './types';
67
import { normalizeUrl } from './utils';
78

89
declare const require: (module: string) => Record<string, any>;
910

10-
function createPlatform(document: any, opts: SerializeDocumentOptions, mapper: SymbolMapper) {
11+
function createPlatform(
12+
document: any,
13+
opts: SerializeDocumentOptions,
14+
mapper: SymbolMapper | undefined
15+
) {
1116
if (!document || (document as Document).nodeType !== 9) {
1217
throw new Error(`Invalid Document implementation`);
1318
}
@@ -43,7 +48,14 @@ function createPlatform(document: any, opts: SerializeDocumentOptions, mapper: S
4348
});
4449
},
4550
chunkForSymbol(symbolName: string) {
46-
return mapper[getSymbolHash(symbolName)];
51+
if (mapper) {
52+
const hash = getSymbolHash(symbolName);
53+
const result = mapper[hash];
54+
if (!result) {
55+
logError('Cannot resolved symbol', symbolName, 'in', mapper);
56+
}
57+
return result;
58+
}
4759
},
4860
};
4961
return serverPlatform;
@@ -56,7 +68,7 @@ function createPlatform(document: any, opts: SerializeDocumentOptions, mapper: S
5668
export async function setServerPlatform(
5769
document: any,
5870
opts: SerializeDocumentOptions,
59-
mapper: SymbolMapper
71+
mapper: SymbolMapper | undefined
6072
) {
6173
const platform = createPlatform(document, opts, mapper);
6274
setPlatform(document, platform);

0 commit comments

Comments
 (0)