Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler): update compiler sys
- Loading branch information
1 parent
bd45a16
commit 4408ec1
Showing
57 changed files
with
1,656 additions
and
869 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,56 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
try { | ||
var minimumVersion = '10.13'; | ||
var recommendedVersion = '12.17'; | ||
var currentVersion = process.versions.node; | ||
|
||
function isNodeLT(v) { | ||
var check = v.split('.').map(Number); | ||
var node = currentVersion.split('.').map(Number); | ||
return node[0] < check[0] || (node[0] === check[0] && node[1] < check[1]); | ||
} | ||
|
||
if (isNodeLT(minimumVersion)) { | ||
console.error( | ||
'\nYour current version of Node is v' + | ||
currentVersion + | ||
', however Stencil requires v' + | ||
minimumVersion + | ||
'.0 or greater. It is recommended to install latest version of Node (https://github.com/nodejs/Release).\n', | ||
); | ||
process.exit(1); | ||
} | ||
|
||
if (isNodeLT(recommendedVersion)) { | ||
console.warn( | ||
'\nYour current version of Node is v' + | ||
currentVersion + | ||
', however Stencil\'s recommendation is v' + | ||
recommendedVersion + | ||
'.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions (https://github.com/nodejs/Release).\n', | ||
); | ||
} | ||
} catch (e) {} | ||
var minimumVersion = '10.13'; | ||
var recommendedVersion = '12.17'; | ||
var currentVersion = process.versions.node; | ||
|
||
function isNodeLT(v) { | ||
var check = v.split('.').map(Number); | ||
var node = currentVersion.split('.').map(Number); | ||
return node[0] < check[0] || (node[0] === check[0] && node[1] < check[1]); | ||
} | ||
|
||
if (isNodeLT(minimumVersion)) { | ||
console.error( | ||
'\nYour current version of Node is v' + | ||
currentVersion + | ||
', however Stencil requires v' + | ||
minimumVersion + | ||
'.0 or greater. It is recommended to install latest version of Node (https://github.com/nodejs/Release).\n', | ||
); | ||
process.exit(1); | ||
} | ||
|
||
if (isNodeLT(recommendedVersion)) { | ||
console.warn( | ||
'\nYour current version of Node is v' + | ||
currentVersion + | ||
", however Stencil's recommendation is v" + | ||
recommendedVersion + | ||
'.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions (https://github.com/nodejs/Release).\n', | ||
); | ||
} | ||
|
||
if (process.argv.indexOf('--next') > -1) { | ||
console.warn('\nThe next compiler is now the default and the --next flag is no longer needed.\n'); | ||
} | ||
|
||
var cli = require('../cli/index.js'); | ||
if (typeof globalThis === 'undefined') { | ||
// globalThis not added until node 12 | ||
global.globalThis = global; | ||
} | ||
|
||
var cli = require('../cli/index.cjs.js'); | ||
var nodeApi = require('../sys/node/index.js'); | ||
var nodeLogger = nodeApi.createNodeLogger({ process: process }); | ||
var nodeSys = nodeApi.createNodeSysWithWatch({ process: process, logger: nodeLogger }); | ||
|
||
nodeApi.setupNodeProcess({ process: process, logger: nodeLogger }); | ||
|
||
cli.run({ | ||
process: process, | ||
logger: cli.createNodeLogger(process), | ||
sys: cli.createNodeSystem(process) | ||
args: process.argv.slice(2), | ||
logger: nodeLogger, | ||
sys: nodeSys, | ||
checkVersion: nodeApi.checkVersion | ||
}); |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
import { initWorkerThread } from './worker/worker-thread'; | ||
import path from './sys/modules/path'; | ||
import { IS_WEB_WORKER_ENV } from '@utils'; | ||
import { createSystem } from './sys/stencil-sys'; | ||
import { createWorkerMessageHandler } from './worker/worker-thread'; | ||
import { initWebWorkerThread } from './sys/worker/web-worker-thread'; | ||
|
||
if (IS_WEB_WORKER_ENV) { | ||
initWebWorkerThread(createWorkerMessageHandler(createSystem())); | ||
} | ||
|
||
export { compile, compileSync, transpile, transpileSync } from './transpile'; | ||
export { createCompiler } from './compiler'; | ||
export { createPrerenderer } from './prerender/prerender-main'; | ||
export { createSystem } from './sys/stencil-sys'; | ||
export { createWorkerContext } from './worker/worker-thread'; | ||
export { createWorkerMessageHandler } from './worker/worker-thread'; | ||
export { dependencies } from './sys/dependencies'; | ||
export { loadConfig } from './config/load-config'; | ||
export { optimizeCss } from './optimize/optimize-css'; | ||
export { optimizeJs } from './optimize/optimize-js'; | ||
export { path }; | ||
export { version } from '../version'; | ||
|
||
initWorkerThread(globalThis); | ||
export { path } from './sys/modules/path'; | ||
export { version, versions, vermoji, buildId } from '../version'; |
Oops, something went wrong.