Skip to content

Commit

Permalink
refactor: rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gioboa committed Jun 19, 2024
1 parent 502e26c commit f64c000
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@
}
],
"kind": "Function",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nopts\n\n\n</td><td>\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n</td><td>\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to `/build/`<!-- -->. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`<!-- -->. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\n[JSXNode](#jsxnode)<!-- -->&lt;\"script\"&gt;",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nopts\n\n\n</td><td>\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n</td><td>\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to `/build/`<!-- -->. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`<!-- -->. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nJSXNode&lt;\"script\"&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts",
"mdFile": "qwik.prefetchgraph.md"
},
Expand All @@ -1774,7 +1774,7 @@
}
],
"kind": "Function",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nInstall a service worker which will prefetch the bundles.\n\nThere can only be one service worker per page. Because there can be many separate Qwik Containers on the page each container needs to load its prefetch graph using `PrefetchGraph` component.\n\n\n```typescript\nPrefetchServiceWorker: (opts: {\n base?: string;\n scope?: string;\n path?: string;\n verbose?: boolean;\n fetchBundleGraph?: boolean;\n nonce?: string;\n}) => JSXNode<'script'>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nopts\n\n\n</td><td>\n\n{ base?: string; scope?: string; path?: string; verbose?: boolean; fetchBundleGraph?: boolean; nonce?: string; }\n\n\n</td><td>\n\nOptions for the prefetch service worker.\n\n- `base` - Base URL for the service worker `import.meta.env.BASE_URL` or `/`<!-- -->. Default is `import.meta.env.BASE_URL` - `scope` - Base URL for when the service-worker will activate. Default is `/` - `path` - Path to the service worker. Default is `qwik-prefetch-service-worker.js` unless you pass a path that starts with a `/` then the base is ignored. Default is `qwik-prefetch-service-worker.js` - `verbose` - Verbose logging for the service worker installation. Default is `false` - `nonce` - Optional nonce value for security purposes, defaults to `undefined`<!-- -->.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\n[JSXNode](#jsxnode)<!-- -->&lt;'script'&gt;",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nInstall a service worker which will prefetch the bundles.\n\nThere can only be one service worker per page. Because there can be many separate Qwik Containers on the page each container needs to load its prefetch graph using `PrefetchGraph` component.\n\n\n```typescript\nPrefetchServiceWorker: (opts: {\n base?: string;\n scope?: string;\n path?: string;\n verbose?: boolean;\n fetchBundleGraph?: boolean;\n nonce?: string;\n}) => JSXNode<'script'>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nopts\n\n\n</td><td>\n\n{ base?: string; scope?: string; path?: string; verbose?: boolean; fetchBundleGraph?: boolean; nonce?: string; }\n\n\n</td><td>\n\nOptions for the prefetch service worker.\n\n- `base` - Base URL for the service worker `import.meta.env.BASE_URL` or `/`<!-- -->. Default is `import.meta.env.BASE_URL` - `scope` - Base URL for when the service-worker will activate. Default is `/` - `path` - Path to the service worker. Default is `qwik-prefetch-service-worker.js` unless you pass a path that starts with a `/` then the base is ignored. Default is `qwik-prefetch-service-worker.js` - `verbose` - Verbose logging for the service worker installation. Default is `false` - `nonce` - Optional nonce value for security purposes, defaults to `undefined`<!-- -->.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nJSXNode&lt;'script'&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts",
"mdFile": "qwik.prefetchserviceworker.md"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/routes/api/qwik/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3625,7 +3625,7 @@ _(Optional)_ Options for the loading prefetch graph.
</tbody></table>
**Returns:**
[JSXNode](#jsxnode)&lt;"script"&gt;
JSXNode&lt;"script"&gt;
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts)
Expand Down Expand Up @@ -3679,7 +3679,7 @@ Options for the prefetch service worker.
</tbody></table>
**Returns:**
[JSXNode](#jsxnode)&lt;'script'&gt;
JSXNode&lt;'script'&gt;
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts)
Expand Down
16 changes: 8 additions & 8 deletions packages/qwik/src/optimizer/src/plugins/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function normalizeRollupOutputOptions(
path: Path,
opts: NormalizedQwikPluginOptions,
rollupOutputOpts: Rollup.OutputOptions | Rollup.OutputOptions[] | undefined,
useCFAssetsDir: boolean
useAssetsDir: boolean
): Rollup.OutputOptions[] {
const outputOpts: Rollup.OutputOptions[] = Array.isArray(rollupOutputOpts)
? // fill the `outputOpts` array with all existing option entries
Expand All @@ -169,21 +169,21 @@ export function normalizeRollupOutputOptions(
}

return outputOpts.map((outputOptsObj) =>
normalizeRollupOutputOptionsObject(path, opts, outputOptsObj, useCFAssetsDir)
normalizeRollupOutputOptionsObject(path, opts, outputOptsObj, useAssetsDir)
);
}

export function normalizeRollupOutputOptionsObject(
path: Path,
opts: NormalizedQwikPluginOptions,
rollupOutputOptsObj: Rollup.OutputOptions | undefined,
useCFAssetsDir: boolean
useAssetsDir: boolean
): Rollup.OutputOptions {
const outputOpts: Rollup.OutputOptions = { ...rollupOutputOptsObj };

if (!outputOpts.assetFileNames) {
const fileName = 'build/q-[hash].[ext]';
outputOpts.assetFileNames = useCFAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.assetFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
}
if (opts.target === 'client') {
// client output
Expand All @@ -192,21 +192,21 @@ export function normalizeRollupOutputOptionsObject(
// client production output
if (!outputOpts.entryFileNames) {
const fileName = 'build/q-[hash].js';
outputOpts.entryFileNames = useCFAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.entryFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
}
if (!outputOpts.chunkFileNames) {
const fileName = 'build/q-[hash].js';
outputOpts.chunkFileNames = useCFAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.chunkFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
}
} else {
// client development output
if (!outputOpts.entryFileNames) {
const fileName = 'build/[name].js';
outputOpts.entryFileNames = useCFAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.entryFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
}
if (!outputOpts.chunkFileNames) {
const fileName = 'build/[name].js';
outputOpts.chunkFileNames = useCFAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.chunkFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
}
}
} else if (opts.buildMode === 'production') {
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik/src/optimizer/src/plugins/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
const vendorRoots = shouldFindVendors
? await findQwikRoots(sys, path.join(sys.cwd(), 'package.json'))
: [];
const useCFAssetsDir =
const useAssetsDir =
target === 'client' &&
!!viteConfig.build?.assetsDir &&
viteConfig.build?.assetsDir !== '_astro';
Expand All @@ -161,7 +161,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
transformedModuleOutput: qwikViteOpts.transformedModuleOutput,
vendorRoots: [...(qwikViteOpts.vendorRoots ?? []), ...vendorRoots.map((v) => v.path)],
outDir: viteConfig.build?.outDir,
assetsDir: useCFAssetsDir ? viteConfig.build?.assetsDir : undefined,
assetsDir: useAssetsDir ? viteConfig.build?.assetsDir : undefined,
devTools: qwikViteOpts.devTools,
sourcemap: !!viteConfig.build?.sourcemap,
lint: qwikViteOpts.lint,
Expand Down Expand Up @@ -342,7 +342,7 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
path,
opts,
viteConfig.build?.rollupOptions?.output,
useCFAssetsDir
useAssetsDir
).map((outputOptsObj) => {
outputOptsObj.dir = buildOutputDir;
return outputOptsObj;
Expand Down

0 comments on commit f64c000

Please sign in to comment.