mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'release-3.0' into 3.0-handle-promise-rejections-module-top-level
# Conflicts: # packages/babel-compiler/.npm/package/npm-shrinkwrap.json
This commit is contained in:
@@ -5,8 +5,8 @@ Package.describe({
|
||||
});
|
||||
|
||||
Npm.depends({
|
||||
// '@meteorjs/babel': '7.18.0-beta.5',
|
||||
'@meteorjs/babel': 'file:///../../../../npm-packages/meteor-babel',
|
||||
'@meteorjs/babel': '7.19.0-beta.1',
|
||||
// '@meteorjs/babel': 'file:///../../../../npm-packages/meteor-babel',
|
||||
'json5': '2.1.1',
|
||||
'semver': '7.3.8'
|
||||
});
|
||||
|
||||
@@ -4,15 +4,19 @@
|
||||
/* for reference: https://tailwindcss.com/docs/customizing-colors */
|
||||
|
||||
--bg-black: #18181b;
|
||||
--neutral-black: #262626;
|
||||
--neutral-black: #343333;
|
||||
--primary-white: #F9FAFB;
|
||||
--red-50: #fef2f2;
|
||||
--red-200: #fecaca;
|
||||
--red-400: #ea5555;
|
||||
--red-600: #dc2626;
|
||||
--red-900: #7f1d1d;
|
||||
--gray-300: #d6d3d1;
|
||||
--gray-400: #a09d9a;
|
||||
--gray-500: #737373;
|
||||
|
||||
--blue-gray-400: #5f6373;
|
||||
|
||||
|
||||
--blue-500: #6366f1;
|
||||
--blue-50: #eef2ff;
|
||||
@@ -61,18 +65,17 @@ body {
|
||||
}
|
||||
|
||||
.header.pass {
|
||||
color: #16a34a; /* green */
|
||||
color: #16a34a;
|
||||
color: var(--green-600); /* green */
|
||||
}
|
||||
|
||||
.header.fail {
|
||||
color: #7f1d1d; /* red */
|
||||
color: var(--red-900); /* red */
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.header .time {
|
||||
color: var(--gray-500);
|
||||
color: #737373;
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -83,8 +86,8 @@ body {
|
||||
}
|
||||
|
||||
.test_table .group {
|
||||
border-left: 1px solid #fef2f2;
|
||||
border-left: 1px solid var(--red-50);
|
||||
border-left: 1px solid #313131;
|
||||
border-left: 1px solid var(--neutral-black);
|
||||
}
|
||||
|
||||
.test_table .group .group {
|
||||
@@ -106,7 +109,7 @@ body {
|
||||
.test_table .groupname {
|
||||
font-weight: bold;
|
||||
background: var(--neutral-black);
|
||||
background: #262626;
|
||||
background: #313131;
|
||||
padding-left: 5px;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
@@ -118,8 +121,8 @@ body {
|
||||
.test_table .event {
|
||||
margin-left: 20px;
|
||||
font-size: 14px;
|
||||
border-left: 2px solid var(--blue-50);
|
||||
border-left: 2px solid #eef2ff;
|
||||
border-left: 2px solid var(--blue-gray-400);
|
||||
border-left: 2px solid #5f6373;
|
||||
padding: 4px;
|
||||
position: relative;
|
||||
}
|
||||
@@ -135,8 +138,8 @@ body {
|
||||
}
|
||||
|
||||
.test_table .failed .testname {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
}
|
||||
|
||||
.test_table .succeeded .testname {
|
||||
@@ -150,7 +153,7 @@ body {
|
||||
width: 100px;
|
||||
left: 0px;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -178,9 +181,9 @@ body {
|
||||
}
|
||||
|
||||
.test_table .failed .teststatus {
|
||||
color: var(--red-900); /* red */
|
||||
color: var(--red-400); /* red */
|
||||
background: var(--bg-black);
|
||||
color: #7F1D1D; /* red */
|
||||
color: #ea5555; /* red */
|
||||
background: #18181b;
|
||||
}
|
||||
|
||||
@@ -190,21 +193,21 @@ body {
|
||||
}
|
||||
|
||||
.test_table .event .expected_fail {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
}
|
||||
|
||||
.test_table .event .fail {
|
||||
color: var(--red-600);
|
||||
color: #dc2626;
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
}
|
||||
|
||||
.test_table .event .exception {
|
||||
color: var(--red-600);
|
||||
color: #dc2626;
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
}
|
||||
|
||||
.exception pre {
|
||||
pre {
|
||||
color: var(--primary-white);
|
||||
color: #F9FAFB;
|
||||
}
|
||||
@@ -225,8 +228,8 @@ body {
|
||||
|
||||
.test_table .event:hover .debug {
|
||||
display: inline;
|
||||
color: var(--gray-500);
|
||||
color: #737373;
|
||||
color: var(--gray-400);
|
||||
color: #a09d9a;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -247,7 +250,6 @@ body {
|
||||
}
|
||||
|
||||
.string_equal_expected ins {
|
||||
background: var(--yellow-400);
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
@@ -265,6 +267,15 @@ body {
|
||||
}
|
||||
|
||||
.failedTests {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
color: var(--red-400);
|
||||
color: #ea5555;
|
||||
}
|
||||
|
||||
#testProgressBar {
|
||||
background: --var(--blue-gray-400);
|
||||
background: #5f6373;
|
||||
}
|
||||
|
||||
.progress-bar.bg-warning {
|
||||
background-color: #f59e0b !important;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
<template name="testInBrowserBody">
|
||||
{{> styles }}
|
||||
<div class="test-in-browser">
|
||||
{{> navBar}}
|
||||
<div class="test-results">
|
||||
@@ -176,282 +175,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template name="styles">
|
||||
<!--
|
||||
TODO FIBERS:
|
||||
TODO Remove this before 3.0 release
|
||||
TODO This is a workaround, brought the styles from driver.css until
|
||||
TODO I can figure out how to get them to load.
|
||||
-->
|
||||
<style>
|
||||
* {
|
||||
/* Variables */
|
||||
/* for reference: https://tailwindcss.com/docs/customizing-colors */
|
||||
|
||||
--bg-black: #18181b;
|
||||
--neutral-black: #262626;
|
||||
--primary-white: #F9FAFB;
|
||||
--red-50: #fef2f2;
|
||||
--red-200: #fecaca;
|
||||
--red-600: #dc2626;
|
||||
--red-900: #7f1d1d;
|
||||
--gray-300: #d6d3d1;
|
||||
--gray-500: #737373;
|
||||
|
||||
|
||||
--blue-500: #6366f1;
|
||||
--blue-50: #eef2ff;
|
||||
|
||||
--yellow-400: #facc15;
|
||||
|
||||
--green-600: #16a34a;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
background-color: #18181b !important;
|
||||
background-color: var(--bg-black) !important;
|
||||
color: #F9FAFB !important;
|
||||
color: var(--primary-white) !important;
|
||||
|
||||
}
|
||||
|
||||
.test-in-browser {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.test-results {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#testProgressBar {
|
||||
flex: 1;
|
||||
max-width: 400px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 24px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.header.in-progress {
|
||||
color: #fef2f2;
|
||||
color: var(--red-50);
|
||||
}
|
||||
|
||||
.header.pass {
|
||||
color: #16a34a; /* green */
|
||||
color: var(--green-600); /* green */
|
||||
}
|
||||
|
||||
.header.fail {
|
||||
color: #7f1d1d; /* red */
|
||||
color: var(--red-900); /* red */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.header .time {
|
||||
color: var(--gray-500);
|
||||
color: #737373;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.test_table {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.test_table .group {
|
||||
border-left: 1px solid #fef2f2;
|
||||
border-left: 1px solid var(--red-50);
|
||||
}
|
||||
|
||||
.test_table .group .group {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.test_table .test {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.test_table .testname {
|
||||
margin-left: 200px;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.test_table .groupname {
|
||||
font-weight: bold;
|
||||
background: var(--neutral-black);
|
||||
background: #262626;
|
||||
padding-left: 5px;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
font-size: 16px;
|
||||
color: var(--primary-white);
|
||||
color: #F9FAFB;
|
||||
}
|
||||
|
||||
.test_table .event {
|
||||
margin-left: 20px;
|
||||
font-size: 14px;
|
||||
border-left: 2px solid var(--blue-50);
|
||||
border-left: 2px solid #eef2ff;
|
||||
padding: 4px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.test_table .test .testrow {
|
||||
position: relative;
|
||||
overflow: hidden; /*hasLayout*/
|
||||
}
|
||||
|
||||
.test_table .running .testname {
|
||||
color: var(--blue-500);
|
||||
color: #6366f1;
|
||||
}
|
||||
|
||||
.test_table .failed .testname {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
}
|
||||
|
||||
.test_table .succeeded .testname {
|
||||
color: var(--green-600);
|
||||
color: #16a34a;
|
||||
}
|
||||
|
||||
.test_table .teststatus {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100px;
|
||||
left: 0px;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.test_table .testtime {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 75px;
|
||||
margin-right: 5px;
|
||||
left: 100px;
|
||||
top: 0;
|
||||
text-align: right;
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
font-size: 14px;
|
||||
color: var(--gray-500);
|
||||
color: #737373;
|
||||
}
|
||||
|
||||
.test_table .succeeded .teststatus {
|
||||
color: var(--green-600);
|
||||
background: var(--bg-black);
|
||||
color: #16a34a;
|
||||
background: #18181b;
|
||||
}
|
||||
|
||||
.test_table .failed .teststatus {
|
||||
color: var(--red-900); /* red */
|
||||
background: var(--bg-black);
|
||||
color: #7F1D1D; /* red */
|
||||
background: #18181b;
|
||||
}
|
||||
|
||||
.test_table .running .teststatus {
|
||||
color: var(--red-50);
|
||||
color: #fef2f2;
|
||||
}
|
||||
|
||||
.test_table .event .expected_fail {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
}
|
||||
|
||||
.test_table .event .fail {
|
||||
color: var(--red-600);
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.test_table .event .exception {
|
||||
color: var(--red-600);
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.exception pre {
|
||||
color: var(--primary-white);
|
||||
color: #F9FAFB;
|
||||
}
|
||||
|
||||
.test_table .event .nodata {
|
||||
color: var(--red-50);
|
||||
color: #fef2f2;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.test_table .event .xtimes, .test_table .event .failkey {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.test_table .event .debug {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.test_table .event:hover .debug {
|
||||
display: inline;
|
||||
color: var(--gray-500);
|
||||
color: #737373;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.in-progress {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.string_equal {
|
||||
line-height: 1.2;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.string_equal ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.string_equal_expected ins {
|
||||
background: var(--yellow-400);
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
.string_equal_actual ins {
|
||||
color: var(--red-600);
|
||||
background: var(--red-200);
|
||||
color: #dc2626;
|
||||
background: #fecaca;
|
||||
}
|
||||
|
||||
#current-client-test {
|
||||
color: var(--gray-300);
|
||||
color: #d6d3d1;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.failedTests {
|
||||
color: var(--red-900);
|
||||
color: #7f1d1d;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
|
||||
@@ -987,10 +987,10 @@ var buildCommands = {
|
||||
main.registerCommand({
|
||||
name: "build",
|
||||
...buildCommands,
|
||||
}, function (options) {
|
||||
return Profile.run(
|
||||
}, async function (options) {
|
||||
return await Profile.run(
|
||||
"meteor build",
|
||||
() => buildCommand(options)
|
||||
async () => await buildCommand(options)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1002,7 +1002,7 @@ main.registerCommand({
|
||||
name: "bundle",
|
||||
hidden: true,
|
||||
...buildCommands,
|
||||
}, function (options) {
|
||||
}, async function (options) {
|
||||
Console.error(
|
||||
"This command has been deprecated in favor of " +
|
||||
Console.command("'meteor build'") + ", which allows you to " +
|
||||
@@ -1011,9 +1011,9 @@ main.registerCommand({
|
||||
"for more information.");
|
||||
Console.error();
|
||||
|
||||
return Profile.run(
|
||||
return await Profile.run(
|
||||
"meteor bundle",
|
||||
() => buildCommand({
|
||||
async () => await buildCommand({
|
||||
...options,
|
||||
_bundleOnly: true,
|
||||
})
|
||||
@@ -2015,9 +2015,9 @@ async function doTestCommand(options) {
|
||||
projectContext = new projectContextModule.ProjectContext(projectContextOptions);
|
||||
await projectContext.init();
|
||||
|
||||
await main.captureAndExit("=> Errors while setting up tests:", function () {
|
||||
await main.captureAndExit("=> Errors while setting up tests:", async function () {
|
||||
// Read metadata and initialize catalog.
|
||||
return projectContext.initializeCatalog();
|
||||
return await projectContext.initializeCatalog();
|
||||
});
|
||||
} else {
|
||||
throw new Error("Unexpected: neither test-packages nor test");
|
||||
@@ -2055,7 +2055,7 @@ async function doTestCommand(options) {
|
||||
|
||||
options.cordovaRunner = cordovaRunner;
|
||||
|
||||
return runTestAppForPackages(projectContext, Object.assign(
|
||||
return await runTestAppForPackages(projectContext, Object.assign(
|
||||
options,
|
||||
{
|
||||
mobileServerUrl: utils.formatUrl(parsedMobileServerUrl),
|
||||
|
||||
@@ -2269,7 +2269,7 @@ class JsImage {
|
||||
if (ret['core-runtime']) {
|
||||
var promise = ret['core-runtime'].waitUntilAllLoaded();
|
||||
if (promise) {
|
||||
promise.await();
|
||||
await promise
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -776,13 +776,16 @@ class ResourceSlot {
|
||||
// stub, so setting .implicit marks the resource as disposable.
|
||||
}).implicit = true;
|
||||
|
||||
if (! cssResource.lazy &&
|
||||
! Buffer.isBuffer(cssResource.data)) {
|
||||
// If there was an error processing this file, cssResource.data
|
||||
// will not be a Buffer, and accessing cssResource.data here
|
||||
// should cause the error to be reported via inputFile.error.
|
||||
return;
|
||||
}
|
||||
// TODO[FIBERS]: Look into this. We probably don't want addStylesheet
|
||||
// to be async, and I'm also not sure the old behavior here is what we wanted
|
||||
//
|
||||
// if (! cssResource.lazy &&s
|
||||
// ! Buffer.isBuffer(cssResource.data)) {
|
||||
// // If there was an error processing this file, cssResource.data
|
||||
// // will not be a Buffer, and accessing cssResource.data here
|
||||
// // should cause the error to be reported via inputFile.error.
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.outputResources.push(cssResource);
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ export default class ImportScanner {
|
||||
private async findImportedModuleIdentifiers(
|
||||
file: File,
|
||||
): Promise<Record<string, ImportInfo>> {
|
||||
const fileHash = await file.hash;
|
||||
const fileHash = file.hash;
|
||||
if (IMPORT_SCANNER_CACHE.has(fileHash)) {
|
||||
return IMPORT_SCANNER_CACHE.get(fileHash);
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,15 @@ export var fullLink = Profile("linker.fullLink", async function (inputFiles, {
|
||||
(bundleArch.startsWith('os.') || enableClientTLA);
|
||||
|
||||
if (wrapForTLA) {
|
||||
// Ensure there is always at least one file
|
||||
// so the globals can be defined
|
||||
if (prelinkedFiles.length === 0) {
|
||||
prelinkedFiles.unshift({
|
||||
source: '',
|
||||
servePath: "/global-imports.js"
|
||||
});
|
||||
}
|
||||
|
||||
let header = getHeader({
|
||||
name: null,
|
||||
imports,
|
||||
|
||||
@@ -420,7 +420,7 @@ async function copyNpmPackageWithSymlinkedNodeModules(fromPkgDir, toPkgDir) {
|
||||
if (item === "node_modules") {
|
||||
// We'll link or copy node_modules in a follow-up step.
|
||||
needToHandleNodeModules = true;
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
await files.cp_r(
|
||||
@@ -442,7 +442,7 @@ async function copyNpmPackageWithSymlinkedNodeModules(fromPkgDir, toPkgDir) {
|
||||
if (depPath === ".bin") {
|
||||
// Avoid copying node_modules/.bin because commands like
|
||||
// .bin/node-gyp and .bin/node-pre-gyp tend to cause problems.
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
const absDepFromPath = files.pathJoin(nodeModulesFromPath, depPath);
|
||||
@@ -450,7 +450,7 @@ async function copyNpmPackageWithSymlinkedNodeModules(fromPkgDir, toPkgDir) {
|
||||
if (! files.stat(absDepFromPath).isDirectory()) {
|
||||
// Only copy package directories, even though there might be other
|
||||
// kinds of files in node_modules.
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
const absDepToPath = files.pathJoin(nodeModulesToPath, depPath);
|
||||
|
||||
@@ -1002,8 +1002,8 @@ Object.assign(ProjectContext.prototype, {
|
||||
? null : self._forceRebuildPackages);
|
||||
}
|
||||
|
||||
await buildmessage.enterJob('building local packages', function () {
|
||||
return self.isopackCache.buildLocalPackages();
|
||||
await buildmessage.enterJob('building local packages', async function () {
|
||||
return await self.isopackCache.buildLocalPackages();
|
||||
});
|
||||
self._completedStage = STAGE.BUILD_LOCAL_PACKAGES;
|
||||
}),
|
||||
|
||||
@@ -170,22 +170,26 @@ class Runner {
|
||||
runLog.log("Started proxy.", { arrow: true });
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {(function(): *)}
|
||||
*/
|
||||
var unblockAppRunner = self.appRunner.makeBeforeStartPromise();
|
||||
|
||||
async function startMongo(tries = 3) {
|
||||
try {
|
||||
await self._startMongoAsync();
|
||||
await unblockAppRunner();
|
||||
unblockAppRunner();
|
||||
} catch (error) {
|
||||
--tries;
|
||||
const left = tries + (tries === 1 ? " try" : " tries");
|
||||
Console.error(
|
||||
`Error starting Mongo (${left} left): ${error.message}`
|
||||
);
|
||||
);
|
||||
|
||||
if (tries > 0) {
|
||||
await self.mongoRunner.stop();
|
||||
await setTimeout(() => startMongo(tries), 1000);
|
||||
setTimeout(async () => await startMongo(tries), 1000);
|
||||
} else {
|
||||
await self.mongoRunner._fail();
|
||||
}
|
||||
@@ -194,13 +198,12 @@ class Runner {
|
||||
}
|
||||
|
||||
await startMongo();
|
||||
|
||||
if (!self.noReleaseCheck && ! self.stopped) {
|
||||
await self.updater.start();
|
||||
self.updater.start();
|
||||
}
|
||||
|
||||
if (!self.stopped && self.hmrServer) {
|
||||
await self.hmrServer.start();
|
||||
self.hmrServer.start();
|
||||
|
||||
if (!self.quiet && !self.stopped) {
|
||||
runLog.log("Started HMR server.", { arrow: true });
|
||||
@@ -209,7 +212,7 @@ class Runner {
|
||||
|
||||
if (! self.stopped) {
|
||||
await buildmessage.enterJob({ title: "starting your app" }, async function () {
|
||||
await self.appRunner.start();
|
||||
await self.appRunner.start();
|
||||
});
|
||||
if (! self.quiet && ! self.stopped) {
|
||||
runLog.log("Started your app.", { arrow: true });
|
||||
@@ -234,8 +237,8 @@ class Runner {
|
||||
}
|
||||
|
||||
if (self.selenium && ! self.stopped) {
|
||||
await buildmessage.enterJob({ title: "starting Selenium" }, function () {
|
||||
return self.selenium.start();
|
||||
await buildmessage.enterJob({ title: "starting Selenium" }, async function () {
|
||||
return await self.selenium.start();
|
||||
});
|
||||
if (! self.quiet && ! self.stopped) {
|
||||
runLog.log("Started Selenium.", { arrow: true });
|
||||
@@ -340,7 +343,6 @@ class Runner {
|
||||
exports.run = async function (options) {
|
||||
var runOptions = _.clone(options);
|
||||
var once = runOptions.once;
|
||||
|
||||
var promise = new Promise(function (resolve) {
|
||||
runOptions.onFailure = async function () {
|
||||
// Ensure that runner stops now. You might think this is unnecessary
|
||||
|
||||
@@ -13,7 +13,7 @@ import { pluginVersionsFromStarManifest } from '../cordova/index.js';
|
||||
import { closeAllWatchers } from "../fs/safe-watcher";
|
||||
import { eachline } from "../utils/eachline";
|
||||
import { loadIsopackage } from '../tool-env/isopackets.js';
|
||||
|
||||
import { once , EventEmitter, on } from "events"
|
||||
// Parse out s as if it were a bash command line.
|
||||
var bashParse = function (s) {
|
||||
if (s.search("\"") !== -1 || s.search("'") !== -1) {
|
||||
@@ -404,31 +404,47 @@ Object.assign(AppRunner.prototype, {
|
||||
self.startPromise = self._makePromise("start");
|
||||
|
||||
self.isRunning = true;
|
||||
self._runApp();
|
||||
|
||||
self._runApp()
|
||||
await self.startPromise;
|
||||
self.startPromise = null;
|
||||
},
|
||||
|
||||
_findCachedEE: function (name) {
|
||||
if (!this._promiseResolvers[name]) {
|
||||
this._promiseResolvers[name] = new EventEmitter();
|
||||
}
|
||||
return this._promiseResolvers[name];
|
||||
},
|
||||
|
||||
_makeIterable : function (name) {
|
||||
var self = this;
|
||||
const ee = self._findCachedEE(name);
|
||||
return on(ee, name);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return {Promise<[any]>}
|
||||
* @private
|
||||
*/
|
||||
_makePromise: function (name) {
|
||||
var self = this;
|
||||
return new Promise(function (resolve) {
|
||||
self._promiseResolvers[name] = resolve;
|
||||
});
|
||||
const ee = self._findCachedEE(name);
|
||||
return once(ee, name);
|
||||
},
|
||||
|
||||
_resolvePromise: function (name, value) {
|
||||
var resolve = this._promiseResolvers[name];
|
||||
if (resolve) {
|
||||
const ee = this._promiseResolvers[name];
|
||||
if (ee) {
|
||||
ee.emit(name, value);
|
||||
this._promiseResolvers[name] = null;
|
||||
resolve(value);
|
||||
}
|
||||
},
|
||||
|
||||
_cleanUpPromises: function () {
|
||||
if (this._promiseResolvers) {
|
||||
_.each(this._promiseResolvers, function (resolve) {
|
||||
resolve && resolve();
|
||||
_.each(this._promiseResolvers, (resolve) => {
|
||||
resolve && this._promiseResolvers[resolve]?.emit(resolve, false);
|
||||
});
|
||||
this._promiseResolvers = null;
|
||||
}
|
||||
@@ -452,10 +468,8 @@ Object.assign(AppRunner.prototype, {
|
||||
|
||||
// The existence of this promise makes the fiber break out of its loop.
|
||||
self.exitPromise = self._makePromise("exit");
|
||||
|
||||
self._resolvePromise("run", { outcome: 'stopped' });
|
||||
self._resolvePromise("watch");
|
||||
|
||||
if (self._beforeStartPromise) {
|
||||
// If we stopped before mongod started (eg, due to mongod startup
|
||||
// failure), unblock the runner fiber from waiting for mongod to start.
|
||||
@@ -472,7 +486,7 @@ Object.assign(AppRunner.prototype, {
|
||||
throw new Error("makeBeforeStartPromise called twice?");
|
||||
}
|
||||
this._beforeStartPromise = this._makePromise("beforeStart");
|
||||
return this._promiseResolvers["beforeStart"];
|
||||
return () => this._resolvePromise("beforeStart");
|
||||
},
|
||||
|
||||
// Run the program once, wait for it to exit, and then return. The
|
||||
@@ -500,7 +514,6 @@ Object.assign(AppRunner.prototype, {
|
||||
// it even if we refreshed previously, since that might have been a
|
||||
// little while ago.
|
||||
catalog.triedToRefreshRecently = false;
|
||||
|
||||
// If this isn't the first time we've run, we need to reset the project
|
||||
// context since everything we have cached may have changed.
|
||||
// XXX We can try to be a little less conservative here:
|
||||
@@ -521,8 +534,8 @@ Object.assign(AppRunner.prototype, {
|
||||
// shown from the previous solution.
|
||||
preservePackageMap: true
|
||||
});
|
||||
var messages = await buildmessage.capture(function () {
|
||||
return self.projectContext.readProjectMetadata();
|
||||
var messages = await buildmessage.capture(async function () {
|
||||
return await self.projectContext.readProjectMetadata();
|
||||
});
|
||||
if (messages.hasMessages()) {
|
||||
return {
|
||||
@@ -548,7 +561,7 @@ Object.assign(AppRunner.prototype, {
|
||||
}
|
||||
|
||||
messages = await buildmessage.capture(async function () {
|
||||
await self.projectContext.prepareProjectForBuild();
|
||||
return await self.projectContext.prepareProjectForBuild();
|
||||
});
|
||||
if (messages.hasMessages()) {
|
||||
return {
|
||||
@@ -573,7 +586,7 @@ Object.assign(AppRunner.prototype, {
|
||||
});
|
||||
}
|
||||
|
||||
var bundleResult = await Profile.run((firstRun?"B":"Reb")+"uild App", async () => {
|
||||
var bundleResult = await Profile.run((firstRun?"B":"Reb")+"uild App", async function() {
|
||||
return await bundler.bundle({
|
||||
projectContext: self.projectContext,
|
||||
outputPath: bundlePath,
|
||||
@@ -618,7 +631,6 @@ Object.assign(AppRunner.prototype, {
|
||||
watchSet.merge(br.clientWatchSet);
|
||||
return watchSet;
|
||||
};
|
||||
|
||||
var bundleResult;
|
||||
var bundleResultOrRunResult = await bundleApp();
|
||||
if (bundleResultOrRunResult.runResult) {
|
||||
@@ -706,8 +718,8 @@ Object.assign(AppRunner.prototype, {
|
||||
// We should have reset self.runPromise to null by now, but await it
|
||||
// just in case it's still defined.
|
||||
await self.runPromise;
|
||||
|
||||
var runPromise = self.runPromise = self._makePromise("run");
|
||||
self.runPromise = self._makePromise("run");
|
||||
var runPromise = self.runPromise;
|
||||
var listenPromise = self._makePromise("listen");
|
||||
|
||||
// Run the program
|
||||
@@ -747,13 +759,13 @@ Object.assign(AppRunner.prototype, {
|
||||
});
|
||||
|
||||
if (options.firstRun && self._beforeStartPromise) {
|
||||
var stopped = await self._beforeStartPromise;
|
||||
if (stopped) {
|
||||
return true;
|
||||
}
|
||||
var [stopped] = await self._beforeStartPromise;
|
||||
if (stopped) {
|
||||
return stopped
|
||||
}
|
||||
}
|
||||
|
||||
await appProcess.start();
|
||||
|
||||
function maybePrintLintWarnings(bundleResult) {
|
||||
if (! (self.projectContext.lintAppAndLocalPackages &&
|
||||
bundleResult.warnings)) {
|
||||
@@ -805,7 +817,7 @@ Object.assign(AppRunner.prototype, {
|
||||
}
|
||||
|
||||
var setupClientWatcher = function () {
|
||||
clientWatcher && clientWatcher.stop();
|
||||
clientWatcher && clientWatcher.stop();
|
||||
clientWatcher = new watch.Watcher({
|
||||
watchSet: bundleResult.clientWatchSet,
|
||||
onChange: function () {
|
||||
@@ -875,17 +887,17 @@ Object.assign(AppRunner.prototype, {
|
||||
|
||||
Console.enableProgressDisplay(false);
|
||||
|
||||
await Promise.race([
|
||||
listenPromise,
|
||||
runPromise]);
|
||||
const postStartupResult = await runPostStartupCallbacks(bundleResult);
|
||||
const promList = [runPromise, listenPromise];
|
||||
await Promise.race(promList)
|
||||
|
||||
const postStartupResult =
|
||||
await runPostStartupCallbacks(bundleResult)
|
||||
|
||||
if (postStartupResult) return postStartupResult;
|
||||
|
||||
// Wait for either the process to exit, or (if watchForChanges) a
|
||||
// source file to change. Or, for stop() to be called.
|
||||
var ret = await runPromise;
|
||||
|
||||
var [ret] = await runPromise;
|
||||
try {
|
||||
while (ret.outcome === 'changed-refreshable') {
|
||||
if (! canRefreshClient) {
|
||||
@@ -895,6 +907,7 @@ Object.assign(AppRunner.prototype, {
|
||||
// We stay in this loop as long as only refreshable assets have changed.
|
||||
// When ret.refreshable becomes false, we restart the server.
|
||||
bundleResultOrRunResult = await bundleApp();
|
||||
|
||||
if (bundleResultOrRunResult.runResult) {
|
||||
return bundleResultOrRunResult.runResult;
|
||||
}
|
||||
@@ -915,7 +928,7 @@ Object.assign(AppRunner.prototype, {
|
||||
if (postStartupResult) return postStartupResult;
|
||||
|
||||
// Wait until another file changes.
|
||||
ret = await oldPromise;
|
||||
[ret] = await oldPromise;
|
||||
}
|
||||
} finally {
|
||||
self.runPromise = null;
|
||||
@@ -928,10 +941,10 @@ Object.assign(AppRunner.prototype, {
|
||||
if (self.hmrServer) {
|
||||
self.hmrServer.setAppState("okay");
|
||||
}
|
||||
appProcess.stop();
|
||||
await appProcess.stop();
|
||||
|
||||
serverWatcher && serverWatcher.stop();
|
||||
clientWatcher && clientWatcher.stop();
|
||||
serverWatcher && serverWatcher.stop();
|
||||
clientWatcher && clientWatcher.stop();
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1002,7 +1015,7 @@ Object.assign(AppRunner.prototype, {
|
||||
}
|
||||
|
||||
if (self.watchForChanges) {
|
||||
self.watchPromise = self._makePromise("watch");
|
||||
self.watchPromise = self._makePromise("watch");
|
||||
|
||||
if (!runResult.watchSet) {
|
||||
throw Error("watching for changes with no watchSet?");
|
||||
|
||||
@@ -595,6 +595,7 @@ var launchMongo = async function(options) {
|
||||
listening &&
|
||||
(noOplog || replSetReadyToBeInitiated || replSetReady)
|
||||
) {
|
||||
|
||||
proc.stdout.removeListener('data', stdoutOnData);
|
||||
resolve();
|
||||
resolve = null;
|
||||
|
||||
@@ -223,7 +223,6 @@ var specialArgPaths = {
|
||||
var loadServerBundles = Profile("Load server bundles", async function () {
|
||||
var infos = [];
|
||||
var nonLocalNodeModulesPaths = new Set();
|
||||
|
||||
for (const fileInfo of serverJson.load) {
|
||||
var code = fs.readFileSync(path.resolve(serverDir, fileInfo.path));
|
||||
|
||||
@@ -503,5 +502,9 @@ var runMain = Profile("Run main()", async function () {
|
||||
await runMain();
|
||||
});
|
||||
});
|
||||
})().catch(e => console.log('error on boot.js', e));
|
||||
})().catch(e => {
|
||||
console.log('error on boot.js', e )
|
||||
console.log(e.stack);
|
||||
process.exit(1)
|
||||
});
|
||||
|
||||
|
||||
@@ -162,9 +162,6 @@ function resolve(id) {
|
||||
resolveInLocalBuild(id) ||
|
||||
resolveInNodeModules(id) ||
|
||||
resolveInDevBundle(id) ||
|
||||
// TODO[fibers]: this is a workaround, fix it
|
||||
(id === '/node_modules/@babel/runtime/helpers/objectSpread2.js' && '/home/denyhs/Documents/work/meteor/meteor/packages/logging/.npm/package/node_modules/@babel/runtime/helpers/objectSpread2.js')||
|
||||
(id === '/node_modules/@babel/runtime/helpers/objectWithoutProperties.js' && '/home/denyhs/Documents/work/meteor/meteor/packages/logging/.npm/package/node_modules/@babel/runtime/helpers/objectWithoutProperties.js')||
|
||||
null;
|
||||
|
||||
return resolve(id);
|
||||
|
||||
@@ -48,7 +48,7 @@ type ExecFileOptions = {
|
||||
* status and signal.
|
||||
* @param command The command to run
|
||||
* @param args List of string arguments
|
||||
* @param options
|
||||
* @param options
|
||||
* @returns The stdout from the command
|
||||
*/
|
||||
export function execFileSync(
|
||||
@@ -67,7 +67,7 @@ export function execFileSync(
|
||||
* the error will contain fields pid, stderr, stdout, status and signal.
|
||||
* @param command The command to run
|
||||
* @param args List of string arguments
|
||||
* @param options
|
||||
* @param options
|
||||
*/
|
||||
export function execFileAsync(
|
||||
command: string,
|
||||
@@ -96,7 +96,7 @@ export function execFileAsync(
|
||||
const exitEvent = options.waitForClose ? 'close' : 'exit';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let child: ReturnType<typeof child_process.exec>;
|
||||
let child: ReturnType<typeof child_process.exec>;
|
||||
const spawnArgs: ReadonlyArray<string> = Array.isArray(args) ? args : [];
|
||||
const { cwd, env, stdio } = options;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user