Parcel upgrade and global dependency update
This commit is contained in:
@@ -65,13 +65,13 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lezer/lr": "^0.15.0",
|
||||
"@parcel/optimizer-data-url": "2.3.2",
|
||||
"@parcel/packager-raw-url": "2.3.2",
|
||||
"@parcel/service-worker": "2.3.2",
|
||||
"@parcel/transformer-inline-string": "2.3.2",
|
||||
"@parcel/transformer-sass": "2.3.2",
|
||||
"@parcel/transformer-webmanifest": "2.3.2",
|
||||
"@parcel/validator-typescript": "2.3.2",
|
||||
"@parcel/optimizer-data-url": "2.6.0",
|
||||
"@parcel/packager-raw-url": "2.6.0",
|
||||
"@parcel/service-worker": "2.6.0",
|
||||
"@parcel/transformer-inline-string": "2.6.0",
|
||||
"@parcel/transformer-sass": "2.6.0",
|
||||
"@parcel/transformer-webmanifest": "2.6.0",
|
||||
"@parcel/validator-typescript": "2.6.0",
|
||||
"@types/events": "^3.0.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^17.0.21",
|
||||
@@ -82,7 +82,7 @@
|
||||
"@vscode/sqlite3": "^5.0.7",
|
||||
"assert": "^2.0.0",
|
||||
"events": "^3.3.0",
|
||||
"parcel": "2.3.2",
|
||||
"parcel": "2.6.0",
|
||||
"prettier": "^2.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,8 @@
|
||||
import { sandboxCompile, sandboxCompileModule } from "../compile";
|
||||
import { SysCallMapping } from "../system";
|
||||
|
||||
import globalModules from "../../common/dist/global.plug.json";
|
||||
|
||||
import * as ts from "typescript";
|
||||
|
||||
type CompileError = {
|
||||
message: string;
|
||||
pos: number;
|
||||
};
|
||||
|
||||
function checkTypeScript(scriptFile: string): void {
|
||||
let program = ts.createProgram([scriptFile], {
|
||||
noEmit: true,
|
||||
allowJs: true,
|
||||
});
|
||||
let emitResult = program.emit();
|
||||
|
||||
let allDiagnostics = ts
|
||||
.getPreEmitDiagnostics(program)
|
||||
.concat(emitResult.diagnostics);
|
||||
|
||||
let errors: CompileError[] = [];
|
||||
allDiagnostics.forEach((diagnostic) => {
|
||||
if (diagnostic.file) {
|
||||
let { line, character } = ts.getLineAndCharacterOfPosition(
|
||||
diagnostic.file,
|
||||
diagnostic.start!
|
||||
);
|
||||
let message = ts.flattenDiagnosticMessageText(
|
||||
diagnostic.messageText,
|
||||
"\n"
|
||||
);
|
||||
errors.push({
|
||||
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
|
||||
pos: diagnostic.start!,
|
||||
});
|
||||
// console.log(
|
||||
// `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
|
||||
// );
|
||||
} else {
|
||||
console.log(
|
||||
ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
console.log(`Process exiting with code '${exitCode}'.`);
|
||||
process.exit(exitCode);
|
||||
}
|
||||
// TODO: FIgure out a better way to do this
|
||||
const builtinModules = ["yaml", "handlebars"];
|
||||
|
||||
export function esbuildSyscalls(): SysCallMapping {
|
||||
return {
|
||||
@@ -71,17 +24,14 @@ export function esbuildSyscalls(): SysCallMapping {
|
||||
functionName,
|
||||
true,
|
||||
[],
|
||||
[...Object.keys(globalModules.dependencies), ...excludeModules]
|
||||
[...builtinModules, ...excludeModules]
|
||||
);
|
||||
},
|
||||
"esbuild.compileModule": async (
|
||||
ctx,
|
||||
moduleName: string
|
||||
): Promise<string> => {
|
||||
return await sandboxCompileModule(
|
||||
moduleName,
|
||||
Object.keys(globalModules.dependencies)
|
||||
);
|
||||
return await sandboxCompileModule(moduleName, builtinModules);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user