@@ -11,7 +11,7 @@ async function createWorkerImportMetaUrlPluginTransform() {
1111
1212 return async ( code : string ) => {
1313 // @ts -expect-error transform should exist
14- const result = await instance . transform . call (
14+ const result = await instance . transform . handler . call (
1515 { environment, parse : parseAst } ,
1616 code ,
1717 'foo.ts' ,
@@ -27,7 +27,7 @@ describe('workerImportMetaUrlPlugin', async () => {
2727 expect (
2828 await transform ( 'new Worker(new URL("./worker.js", import.meta.url))' ) ,
2929 ) . toMatchInlineSnapshot (
30- `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))"` ,
30+ `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url))"` ,
3131 )
3232 } )
3333
@@ -37,7 +37,7 @@ describe('workerImportMetaUrlPlugin', async () => {
3737 'new SharedWorker(new URL("./worker.js", import.meta.url))' ,
3838 ) ,
3939 ) . toMatchInlineSnapshot (
40- `"new SharedWorker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url))"` ,
40+ `"new SharedWorker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url))"` ,
4141 )
4242 } )
4343
@@ -47,7 +47,7 @@ describe('workerImportMetaUrlPlugin', async () => {
4747 'new Worker(new URL("./worker.js", import.meta.url), { type: "module", name: "worker1" })' ,
4848 ) ,
4949 ) . toMatchInlineSnapshot (
50- `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { type: "module", name: "worker1" })"` ,
50+ `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { type: "module", name: "worker1" })"` ,
5151 )
5252 } )
5353
@@ -57,7 +57,7 @@ describe('workerImportMetaUrlPlugin', async () => {
5757 'new Worker(new URL("./worker.js", import.meta.url), { "type": "module", "name": "worker1" })' ,
5858 ) ,
5959 ) . toMatchInlineSnapshot (
60- `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { "type": "module", "name": "worker1" })"` ,
60+ `"new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { "type": "module", "name": "worker1" })"` ,
6161 )
6262 } )
6363
@@ -67,7 +67,7 @@ describe('workerImportMetaUrlPlugin', async () => {
6767 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: "worker" + id })' ,
6868 ) ,
6969 ) . toMatchInlineSnapshot (
70- `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", import.meta.url), { name: "worker" + id })"` ,
70+ `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=classic", '' + import.meta.url), { name: "worker" + id })"` ,
7171 )
7272 } )
7373
@@ -77,7 +77,7 @@ describe('workerImportMetaUrlPlugin', async () => {
7777 'const id = 1; new Worker(new URL("./worker.js", import.meta.url), { name: "worker" + id, type: "module" })' ,
7878 ) ,
7979 ) . toMatchInlineSnapshot (
80- `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: "worker" + id, type: "module" })"` ,
80+ `"const id = 1; new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { name: "worker" + id, type: "module" })"` ,
8181 )
8282 } )
8383
@@ -87,7 +87,7 @@ describe('workerImportMetaUrlPlugin', async () => {
8787 'const worker = new Worker(new URL("./worker.js", import.meta.url), { name: genName(), type: "module"})' ,
8888 ) ,
8989 ) . toMatchInlineSnapshot (
90- `"const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), { name: genName(), type: "module"})"` ,
90+ `"const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), { name: genName(), type: "module"})"` ,
9191 )
9292 } )
9393
@@ -102,15 +102,17 @@ const worker = new Worker(new URL("./worker.js", import.meta.url), {
102102
103103worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data)))
104104` ) ,
105- ) . toMatchInlineSnapshot ( `"
106- const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", import.meta.url), {
107- name: genName(),
108- type: "module",
109- },
110- )
111-
112- worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data)))
113- "` )
105+ ) . toMatchInlineSnapshot ( `
106+ "
107+ const worker = new Worker(new URL(/* @vite-ignore */ "/worker.js?worker_file&type=module", '' + import.meta.url), {
108+ name: genName(),
109+ type: "module",
110+ },
111+ )
112+
113+ worker.addEventListener('message', (ev) => text('.simple-worker-url', JSON.stringify(ev.data)))
114+ "
115+ ` )
114116 } )
115117
116118 test ( 'throws an error when non-static worker options are provided' , async ( ) => {
0 commit comments