Skip to content

Commit

Permalink
高速化した...のか?
Browse files Browse the repository at this point in the history
  • Loading branch information
nakasyou committed Dec 8, 2023
1 parent e00dc7c commit 47c07c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 87 deletions.
12 changes: 8 additions & 4 deletions compiler/core/compile/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export type CompileState = {
state: 'ZIPING'
} | {
state: 'COMPILED'
} | {
state: 'READY'
}

export const compile = (chromeExtension: Extension, opts: CompilerInit): CompileResult => {
Expand All @@ -74,7 +76,7 @@ export const compile = (chromeExtension: Extension, opts: CompilerInit): Compile
}
}
const stateStream = new StateStream()
;(async () => {
const run = async () => {
const crxData = chromeExtension.getCrxData()
nextStateFunc({
state: 'CRX_TO_ZIP'
Expand Down Expand Up @@ -129,7 +131,6 @@ export const compile = (chromeExtension: Extension, opts: CompilerInit): Compile
for (const plugin of plugins) {
await plugin.onCompile(compileInit)
}

fileTree['manifest.json'] = new TextEncoder().encode(JSON.stringify(manifestJson, null, 2))
nextStateFunc({
state: 'ZIPING'
Expand All @@ -140,8 +141,11 @@ export const compile = (chromeExtension: Extension, opts: CompilerInit): Compile
nextStateFunc({
state: 'COMPILED'
})
})()

}
nextStateFunc({
state: 'READY'
})
run()
return {
compiled,
stateStream: stateStream
Expand Down
82 changes: 0 additions & 82 deletions compiler/core/compile/transformer.ts

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/dev-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for await (const state of compileProcess.stateStream) {
console.timeEnd('state')

const xpiData = await compileProcess.compiled

console.log(xpiData)
await Deno.writeFile(join('tmp', Deno.args[0] + '.xpi'), xpiData)
await emptyDir(join('tmp', Deno.args[0]))
for (const [path, data] of Object.entries(unzipSync(xpiData))) {
Expand Down

0 comments on commit 47c07c3

Please sign in to comment.