test: remove jsx plugin from worker playground (#11177)

This commit is contained in:
翠 / green 2022-12-06 15:18:13 +09:00 committed by GitHub
parent 014e4aaa85
commit 51ceb4ee5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 26 additions and 156 deletions

View File

@ -57,7 +57,7 @@ describe.runIf(isBuild)('build', () => {
test('inlined code generation', async () => {
const assetsDir = path.resolve(testDir, 'dist/es/assets')
const files = fs.readdirSync(assetsDir)
expect(files.length).toBe(27)
expect(files.length).toBe(28)
const index = files.find((f) => f.includes('main-module'))
const content = fs.readFileSync(path.resolve(assetsDir, index), 'utf-8')
const worker = files.find((f) => f.includes('my-worker'))

View File

@ -0,0 +1 @@
export const bundleWithPlugin = 'worker bundle with plugin fail. '

View File

@ -1 +0,0 @@
export const bundleWithPlugin: string = 'worker bundle with plugin success!'

View File

@ -25,8 +25,5 @@
},
"dependencies": {
"@vitejs/test-dep-to-optimize": "file:./dep-to-optimize"
},
"devDependencies": {
"@vitejs/plugin-vue-jsx": "^3.0.0-alpha.0"
}
}

View File

@ -1,5 +1,5 @@
const vueJsx = require('@vitejs/plugin-vue-jsx')
const vite = require('vite')
const workerPluginTestPlugin = require('./worker-plugin-test-plugin')
module.exports = vite.defineConfig({
base: '/es/',
@ -11,7 +11,7 @@ module.exports = vite.defineConfig({
},
worker: {
format: 'es',
plugins: [vueJsx()],
plugins: [workerPluginTestPlugin()],
rollupOptions: {
output: {
assetFileNames: 'assets/worker_asset-[name].[ext]',
@ -31,6 +31,7 @@ module.exports = vite.defineConfig({
},
},
plugins: [
workerPluginTestPlugin(),
{
name: 'resolve-format-es',

View File

@ -1,5 +1,5 @@
const vueJsx = require('@vitejs/plugin-vue-jsx')
const vite = require('vite')
const workerPluginTestPlugin = require('./worker-plugin-test-plugin')
module.exports = vite.defineConfig({
base: '/iife/',
@ -11,7 +11,7 @@ module.exports = vite.defineConfig({
worker: {
format: 'iife',
plugins: [
vueJsx(),
workerPluginTestPlugin(),
{
name: 'config-test',
config() {
@ -46,4 +46,5 @@ module.exports = vite.defineConfig({
},
},
},
plugins: [workerPluginTestPlugin()],
})

View File

@ -1,6 +1,6 @@
const path = require('node:path')
const vueJsx = require('@vitejs/plugin-vue-jsx')
const vite = require('vite')
const workerPluginTestPlugin = require('./worker-plugin-test-plugin')
module.exports = vite.defineConfig({
base: './',
@ -11,7 +11,7 @@ module.exports = vite.defineConfig({
},
worker: {
format: 'es',
plugins: [vueJsx()],
plugins: [workerPluginTestPlugin()],
rollupOptions: {
output: {
assetFileNames: 'worker-assets/worker_asset-[name]-[hash].[ext]',
@ -34,6 +34,7 @@ module.exports = vite.defineConfig({
baseRoute: '/relative-base/',
},
plugins: [
workerPluginTestPlugin(),
{
name: 'resolve-format-es',
transform(code, id) {

View File

@ -1,5 +1,5 @@
const vueJsx = require('@vitejs/plugin-vue-jsx')
const vite = require('vite')
const workerPluginTestPlugin = require('./worker-plugin-test-plugin')
module.exports = vite.defineConfig((sourcemap) => {
sourcemap = process.env.WORKER_MODE || sourcemap
@ -17,7 +17,7 @@ module.exports = vite.defineConfig((sourcemap) => {
},
worker: {
format: 'iife',
plugins: [vueJsx()],
plugins: [workerPluginTestPlugin()],
rollupOptions: {
output: {
assetFileNames: 'assets/[name]-worker_asset[hash].[ext]',
@ -39,5 +39,6 @@ module.exports = vite.defineConfig((sourcemap) => {
},
},
},
plugins: [workerPluginTestPlugin()],
}
})

View File

@ -0,0 +1,12 @@
module.exports = () => ({
name: 'plugin-for-worker',
transform(code, id) {
if (id.includes('worker/modules/test-plugin.js')) {
return {
// keep length for sourcemap
code: code.replace('plugin fail. ', 'plugin success!'),
map: null,
}
}
},
})

View File

@ -1082,12 +1082,9 @@ importers:
playground/worker:
specifiers:
'@vitejs/plugin-vue-jsx': ^3.0.0-alpha.0
'@vitejs/test-dep-to-optimize': file:./dep-to-optimize
dependencies:
'@vitejs/test-dep-to-optimize': file:playground/worker/dep-to-optimize
devDependencies:
'@vitejs/plugin-vue-jsx': 3.0.0-alpha.0
playground/worker/dep-to-optimize:
specifiers: {}
@ -1260,13 +1257,6 @@ packages:
jsesc: 2.5.2
dev: true
/@babel/helper-annotate-as-pure/7.18.6:
resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.5
dev: true
/@babel/helper-compilation-targets/7.20.0_@babel+core@7.20.5:
resolution: {integrity: sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==}
engines: {node: '>=6.9.0'}
@ -1280,24 +1270,6 @@ packages:
semver: 6.3.0
dev: true
/@babel/helper-create-class-features-plugin/7.20.2_@babel+core@7.20.5:
resolution: {integrity: sha512-k22GoYRAHPYr9I+Gvy2ZQlAe5mGy8BqWst2wRt8cwIufWTxrsVshhIBvYNqC80N0GSFWTsqRVexOtfzlgOEDvA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.20.5
'@babel/helper-annotate-as-pure': 7.18.6
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.19.0
'@babel/helper-member-expression-to-functions': 7.18.9
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/helper-replace-supers': 7.19.1
'@babel/helper-split-export-declaration': 7.18.6
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-environment-visitor/7.18.9:
resolution: {integrity: sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==}
engines: {node: '>=6.9.0'}
@ -1318,13 +1290,6 @@ packages:
'@babel/types': 7.20.5
dev: true
/@babel/helper-member-expression-to-functions/7.18.9:
resolution: {integrity: sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.5
dev: true
/@babel/helper-module-imports/7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
@ -1348,31 +1313,6 @@ packages:
- supports-color
dev: true
/@babel/helper-optimise-call-expression/7.18.6:
resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.5
dev: true
/@babel/helper-plugin-utils/7.20.2:
resolution: {integrity: sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-replace-supers/7.19.1:
resolution: {integrity: sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-member-expression-to-functions': 7.18.9
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/traverse': 7.20.5
'@babel/types': 7.20.5
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-simple-access/7.20.2:
resolution: {integrity: sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==}
engines: {node: '>=6.9.0'}
@ -1427,40 +1367,6 @@ packages:
dependencies:
'@babel/types': 7.20.5
/@babel/plugin-syntax-jsx/7.18.6_@babel+core@7.20.5:
resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.5
'@babel/helper-plugin-utils': 7.20.2
dev: true
/@babel/plugin-syntax-typescript/7.20.0_@babel+core@7.20.5:
resolution: {integrity: sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.5
'@babel/helper-plugin-utils': 7.20.2
dev: true
/@babel/plugin-transform-typescript/7.20.2_@babel+core@7.20.5:
resolution: {integrity: sha512-jvS+ngBfrnTUBfOQq8NfGnSbF9BrqlR6hjJ2yVxMkmO5nL/cdifNbI30EfjRlN4g5wYWNnMPyj5Sa6R1pbLeag==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.5
'@babel/helper-create-class-features-plugin': 7.20.2_@babel+core@7.20.5
'@babel/helper-plugin-utils': 7.20.2
'@babel/plugin-syntax-typescript': 7.20.0_@babel+core@7.20.5
transitivePeerDependencies:
- supports-color
dev: true
/@babel/runtime/7.20.6:
resolution: {integrity: sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA==}
engines: {node: '>=6.9.0'}
@ -2332,20 +2238,6 @@ packages:
eslint-visitor-keys: 3.3.0
dev: true
/@vitejs/plugin-vue-jsx/3.0.0-alpha.0:
resolution: {integrity: sha512-301Bbw+Ap+1EPYB/e8uDYAFAE/MNGb2TPf7zHLxVUagVkG9hkjFU4raUFucXtQ/cB8NkWBqcP66luS7rHgBCxQ==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
vite: ^3.0.0
vue: ^3.0.0
dependencies:
'@babel/core': 7.20.5
'@babel/plugin-transform-typescript': 7.20.2_@babel+core@7.20.5
'@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.20.5
transitivePeerDependencies:
- supports-color
dev: true
/@vitejs/plugin-vue/3.2.0_vp6yl3plkfvihwzjgzhs7aemmy:
resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==}
engines: {node: ^14.18.0 || >=16.0.0}
@ -2367,27 +2259,6 @@ packages:
vue: 3.2.45
dev: true
/@vue/babel-helper-vue-transform-on/1.0.2:
resolution: {integrity: sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==}
dev: true
/@vue/babel-plugin-jsx/1.1.1_@babel+core@7.20.5:
resolution: {integrity: sha512-j2uVfZjnB5+zkcbc/zsOc0fSNGCMMjaEXP52wdwdIfn0qjFfEYpYZBFKFg+HHnQeJCVrjOeO0YxgaL7DMrym9w==}
dependencies:
'@babel/helper-module-imports': 7.18.6
'@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.20.5
'@babel/template': 7.18.10
'@babel/traverse': 7.20.5
'@babel/types': 7.20.5
'@vue/babel-helper-vue-transform-on': 1.0.2
camelcase: 6.3.0
html-tags: 3.2.0
svg-tags: 1.0.0
transitivePeerDependencies:
- '@babel/core'
- supports-color
dev: true
/@vue/compiler-core/3.2.45:
resolution: {integrity: sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==}
dependencies:
@ -2912,11 +2783,6 @@ packages:
engines: {node: '>=6'}
dev: true
/camelcase/6.3.0:
resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==}
engines: {node: '>=10'}
dev: true
/caniuse-lite/1.0.30001427:
resolution: {integrity: sha512-lfXQ73oB9c8DP5Suxaszm+Ta2sr/4tf8+381GkIm1MLj/YdLf+rEDyDSRCzeltuyTVGm+/s18gdZ0q+Wmp8VsQ==}
@ -5201,11 +5067,6 @@ packages:
resolution: {integrity: sha512-b+pOh+bs00uRVNIZoTgGBREjUKN47pchTNwkxKuP4ecQTFcOA6KJIW+jjvjjXrkSRURZsideLxFKqX7hnxdegQ==}
dev: true
/html-tags/3.2.0:
resolution: {integrity: sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==}
engines: {node: '>=8'}
dev: true
/http-cache-semantics/4.1.0:
resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==}
dev: true
@ -7807,10 +7668,6 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
/svg-tags/1.0.0:
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
dev: true
/systemjs/6.13.0:
resolution: {integrity: sha512-P3cgh2bpaPvAO2NE3uRp/n6hmk4xPX4DQf+UzTlCAycssKdqhp6hjw+ENWe+aUS7TogKRFtptMosTSFeC6R55g==}
dev: false