chore: Rename templates to virtual-modules (#24)

This commit is contained in:
Aaron
2023-07-02 21:49:01 -05:00
committed by GitHub
parent e14f81d97a
commit 75eb3de89e
7 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -11,7 +11,7 @@ const spinner = ora('Building WXT').start();
const startTime = Date.now();
const outDir = 'dist';
const clientTemplates = ['background', 'content-script'];
const virtualEntrypoints = ['background', 'content-script'];
await fs.rm(outDir, { recursive: true, force: true });
@@ -38,20 +38,20 @@ await Promise.all([
dts: true,
silent: true,
}),
...clientTemplates.map((templateName) =>
...virtualEntrypoints.map((entryName) =>
tsup.build({
entry: {
[`templates/virtual-${templateName}`]: `src/client/templates/virtual-${templateName}.ts`,
[`virtual-modules/${entryName}-entrypoint`]: `src/client/virtual-modules/${entryName}-entrypoint.ts`,
},
format: ['esm'],
sourcemap: true,
silent: true,
external: [`virtual:user-${templateName}`],
external: [`virtual:user-${entryName}`],
}),
),
tsup.build({
entry: {
'templates/reload-html': `src/client/templates/reload-html.ts`,
'virtual-modules/reload-html': `src/client/virtual-modules/reload-html.ts`,
},
format: ['esm'],
sourcemap: true,
@@ -1,4 +1,4 @@
// Types required to make templates happy.
// Types required to make the virtual modules happy.
declare module '*?raw' {
const content: any;
+1 -1
View File
@@ -18,7 +18,7 @@ export function devHtmlPrerender(config: InternalConfig): vite.Plugin {
alias: {
'@wxt/reload-html': resolve(
config.root,
'node_modules/wxt/dist/templates/reload-html.js',
'node_modules/wxt/dist/virtual-modules/reload-html.js',
),
},
},
+1 -1
View File
@@ -31,7 +31,7 @@ export function virtualEntrypoin(
const template = await fs.readFile(
resolve(
config.root,
`node_modules/wxt/dist/templates/virtual-${type}.js`,
`node_modules/wxt/dist/virtual-modules/${type}-entrypoint.js`,
),
'utf-8',
);