From 50740592579e520f960a03dc4cf5d5d7f5508243 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Fri, 8 Mar 2024 11:02:29 -0800 Subject: [PATCH] fix(dev-tools): remove log prefix (#459) --- .ocularrc.js | 4 +--- modules/dev-tools/package.json | 3 +-- modules/dev-tools/src/configuration/vite.config.js | 12 +----------- modules/dev-tools/src/helpers/get-ocular-config.ts | 12 ++++++------ test/index.html | 9 +++++++++ 5 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 test/index.html diff --git a/.ocularrc.js b/.ocularrc.js index abaffbcc..11e69f51 100644 --- a/.ocularrc.js +++ b/.ocularrc.js @@ -19,9 +19,7 @@ let ocularConfig = { entry: { test: 'test/node.ts', - 'test-browser': 'test/browser.ts', - bench: 'test/bench/node.js', - 'bench-browser': 'test/bench/browser.js', + 'test-browser': 'test/index.html', size: 'test/size/import-nothing.js' } }; diff --git a/modules/dev-tools/package.json b/modules/dev-tools/package.json index c02972cd..1722f2cc 100644 --- a/modules/dev-tools/package.json +++ b/modules/dev-tools/package.json @@ -103,8 +103,7 @@ "ts-node": "~10.9.0", "ts-patch": "^3.1.2", "tsconfig-paths": "^4.1.1", - "vite": "^4.0.1", - "vite-plugin-html": "^3.2.0" + "vite": "^4.5.0" }, "devDependencies": { "puppeteer": "^22.0.0" diff --git a/modules/dev-tools/src/configuration/vite.config.js b/modules/dev-tools/src/configuration/vite.config.js index e08884b3..4532a1ee 100644 --- a/modules/dev-tools/src/configuration/vite.config.js +++ b/modules/dev-tools/src/configuration/vite.config.js @@ -1,6 +1,5 @@ import {defineConfig} from 'vite'; import {getOcularConfig} from '../helpers/get-ocular-config.js'; -import {createHtmlPlugin} from 'vite-plugin-html'; import {NodeGlobalsPolyfillPlugin} from '@esbuild-plugins/node-globals-polyfill'; import {NodeModulesPolyfillPlugin} from '@esbuild-plugins/node-modules-polyfill'; @@ -9,18 +8,9 @@ export default defineConfig(async ({mode}) => { const entryPoint = ocularConfig.entry[`${mode}-browser`]; return { - plugins: entryPoint.endsWith('.html') - ? [] - : [ - // If entry is a js/ts file, create a virtual html - createHtmlPlugin({ - minify: false, - entry: ocularConfig.entry[`${mode}-browser`] - }) - ], optimizeDeps: { // Disable crawling the whole repo - entries: entryPoint.endsWith('.html') ? [entryPoint] : [], + entries: [entryPoint], // Polyfill for Node environment (required by tape-promise) esbuildOptions: { define: { diff --git a/modules/dev-tools/src/helpers/get-ocular-config.ts b/modules/dev-tools/src/helpers/get-ocular-config.ts index 4a4caa42..46a9f400 100644 --- a/modules/dev-tools/src/helpers/get-ocular-config.ts +++ b/modules/dev-tools/src/helpers/get-ocular-config.ts @@ -59,9 +59,9 @@ export type OcularConfig = { entry?: { test?: string; - 'test-browser'?: string; + 'test-browser'?: `${string}.html`; bench?: string; - 'bench-browser'?: string; + 'bench-browser'?: `${string}.html`; size?: string[] | string; }; }; @@ -114,9 +114,9 @@ export type MaterializedOcularConfig = { entry: { test: string; - 'test-browser': string; + 'test-browser': `${string}.html`; bench: string; - 'bench-browser': string; + 'bench-browser': `${string}.html`; size: string[]; }; }; @@ -174,9 +174,9 @@ export async function getOcularConfig( entry: { test: 'test/index.ts', - 'test-browser': 'test/browser.ts', + 'test-browser': 'test/index.html', bench: 'test/bench/index.ts', - 'bench-browser': 'test/bench/browser.ts', + 'bench-browser': 'test/bench/index.html', size: ['test/size.ts'] }, diff --git a/test/index.html b/test/index.html new file mode 100644 index 00000000..40c8d857 --- /dev/null +++ b/test/index.html @@ -0,0 +1,9 @@ + + + + luma.gl tests + + + + +