Skip to content

Commit

Permalink
create new server-build, for server side use cases (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri authored May 5, 2021
1 parent e08c069 commit 3bdf0d2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
22 changes: 22 additions & 0 deletions config/rollup.worker-thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ const compilePlugins = [
// So, here we continue to use the '.mjs' extension to indicate newer ECMASCRIPT support
// but ensure the code can be run within a worker by putting it inside a named iife.
const ESModules = [
{
input: 'output/worker-thread/server-lib.js',
output: {
file: 'dist/server-lib.mjs',
format: 'es',
name: 'ServerLib',
sourcemap: true,
},
plugins: [
replace({
values: {
WORKER_DOM_DEBUG: false,
},
preventAssignment: true,
}),
babelPlugin({
transpileToES5: false,
allowConsole: false,
}),
...compilePlugins,
],
},
{
input: 'output/worker-thread/index.js',
output: {
Expand Down
7 changes: 7 additions & 0 deletions src/worker-thread/server-lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Document } from './dom/Document';
import { GlobalScope } from './WorkerDOMGlobalScope';

export function createDocument() {
const win: GlobalScope = {} as any;
return new Document(win);
}

0 comments on commit 3bdf0d2

Please sign in to comment.