-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from bldrs-ai/server-conway-and-webifc
Print time and mem stats for webifc
- Loading branch information
Showing
23 changed files
with
152,115 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import esbuild from 'esbuild' | ||
import {webIfcShimAliasPlugin} from './web-ifc-shim-alias-plugin.js' | ||
import {webIfcThreeImportFixupPlugin} from './web-ifc-three-import-fixup.js' | ||
|
||
|
||
export function doBuild(entryPoints, outfile, isConway = true) { | ||
const plugins = [webIfcThreeImportFixupPlugin] | ||
const defines = {} | ||
if (isConway) { | ||
defines['process.env.ENGINE'] = '"conway"' | ||
defines['process.env.INCLUDE_WEB_IFC_SHIM_ALIAS_PLUGIN'] = 'true' | ||
plugins.push(webIfcShimAliasPlugin(isConway)) | ||
console.log('Using conway backend') | ||
} else { | ||
defines['process.env.ENGINE'] = '"webifc"' | ||
console.log('Using web-ifc backend') | ||
} | ||
|
||
esbuild.build({ | ||
entryPoints: entryPoints, | ||
outfile: outfile, | ||
bundle: true, | ||
format: 'esm', | ||
target: ['node18'], | ||
platform: 'node', | ||
minify: false, | ||
external: externalPackages, | ||
sourcemap: true, | ||
logLevel: 'info', | ||
plugins: plugins, | ||
define: defines, | ||
banner:{ | ||
js: ` | ||
import { createRequire as topLevelCreateRequire } from 'node:module'; | ||
import { dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
const require = topLevelCreateRequire(import.meta.url); | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
` | ||
}, | ||
}) | ||
} | ||
|
||
|
||
// These usually have dynamic requires that make the bundler or node | ||
// interpreter unhappy unless they're linked at runtime. | ||
const externalPackages = [ | ||
'bindings', | ||
'form-data', | ||
'combined-stream', | ||
'express', | ||
'follow-redirects', | ||
'gl', | ||
'jsdom', | ||
'pngjs', | ||
'proxy-from-env', | ||
'winston', | ||
'@colors', | ||
'@sentry', | ||
// '../external/web-ifc-api-node.cjs', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {doBuild} from './common.js' | ||
|
||
doBuild(['./src/headless.js'], './build/headless-webifc.node.js', false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {doBuild} from './common.js' | ||
|
||
doBuild(['./src/headless.js'], './build/headless.node.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {doBuild} from './common.js' | ||
|
||
doBuild(['./src/server/index.js'], './build/server-webifc.node.js', false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {doBuild} from './common.js' | ||
|
||
doBuild(['./src/server/index.js'], './build/server.node.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.