Skip to content

Commit

Permalink
Merge pull request meteor#10927 from meteor/release-1.9.2
Browse files Browse the repository at this point in the history
Release 1.9.2
  • Loading branch information
Ben Newman authored Feb 20, 2020
2 parents 17eb5ba + b96fe01 commit 34f8807
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 274 deletions.
20 changes: 20 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## v1.9.2, 2020-02-20

### Breaking changes
N/A

### Migration Steps
N/A

### Changes

* Node.js has been updated to version
[12.16.1](https://nodejs.org/en/blog/release/v12.16.1/), fixing several
unintended
[regressions](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#12.16.1)
introduced in 12.16.0.

* The `meteor-babel` npm package has been updated to version 7.8.2.

* The `typescript` npm package has been updated to version 3.7.5.

## v1.9.1, 2020-02-18

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion meteor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

BUNDLE_VERSION=12.16.0.0
BUNDLE_VERSION=12.16.1.1

# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.
Expand Down
497 changes: 251 additions & 246 deletions packages/babel-compiler/.npm/package/npm-shrinkwrap.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/babel-compiler/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Package.describe({
// isn't possible because you can't publish a non-recommended
// release with package versions that don't have a pre-release
// identifier at the end (eg, -dev)
version: '7.5.0'
version: '7.5.2'
});

Npm.depends({
'meteor-babel': '7.7.5',
'meteor-babel': '7.8.2',
'json5': '2.1.1'
});

Expand Down
2 changes: 1 addition & 1 deletion packages/ecmascript/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ecmascript',
version: '0.14.0',
version: '0.14.2',
summary: 'Compiler plugin that supports ES2015+ in all .js files',
documentation: 'README.md'
});
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-tool/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
summary: "The Meteor command-line tool",
version: '1.9.1'
version: '1.9.2'
});

Package.includeTool();
4 changes: 4 additions & 0 deletions packages/modules-runtime/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Module.prototype.useNode = function () {
return false;
}

// See tools/static-assets/server/npm-require.js for the implementation
// of npmRequire. Note that this strategy fails when importing ESM
// modules (typically, a .js file in a package with "type": "module" in
// its package.json), as of Node 12.16.0 (Meteor 1.9.1).
this.exports = npmRequire(this.id);

return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: "typescript",
version: "3.7.2",
version: "3.7.5",
summary: "Compiler plugin that compiles TypeScript and ECMAScript in .ts and .tsx files",
documentation: "README.md"
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/admin/meteor-release-experimental.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"track": "METEOR",
"version": "1.9.1-rc.1",
"version": "1.9.2-rc.1",
"recommended": false,
"official": false,
"description": "Meteor"
Expand Down
2 changes: 1 addition & 1 deletion scripts/admin/meteor-release-official.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"track": "METEOR",
"version": "1.9.1",
"version": "1.9.2",
"recommended": false,
"official": true,
"description": "The Official Meteor Distribution"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-dev-bundle-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -u

UNAME=$(uname)
ARCH=$(uname -m)
NODE_VERSION=12.16.0
NODE_VERSION=12.16.1
MONGO_VERSION_64BIT=4.0.6
MONGO_VERSION_32BIT=3.2.22
NPM_VERSION=6.13.4
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev-bundle-server-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var packageJson = {
"meteor-promise": "0.8.7",
promise: "8.0.2",
reify: "0.20.12",
"@babel/parser": "7.7.5",
"@babel/parser": "7.8.4",
"@types/underscore": "1.9.2",
underscore: "1.9.1",
"source-map-support": "https://github.com/meteor/node-source-map-support/tarball/1912478769d76e5df4c365e147f25896aee6375e",
Expand Down
6 changes: 3 additions & 3 deletions scripts/dev-bundle-tool-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ var packageJson = {
pacote: "https://github.com/meteor/pacote/tarball/6c03d5b9497d6c96c5e421a63bdf70b843657ae7",
"node-gyp": "6.0.1",
"node-pre-gyp": "0.14.0",
typescript: "3.7.3",
"meteor-babel": "7.7.5",
typescript: "3.7.5",
"meteor-babel": "7.8.2",
// Keep the versions of these packages consistent with the versions
// found in dev-bundle-server-package.js.
"meteor-promise": "0.8.7",
fibers: "4.0.3",
reify: "0.20.12",
// So that Babel can emit require("@babel/runtime/helpers/...") calls.
"@babel/runtime": "7.7.6",
"@babel/runtime": "7.8.4",
// For backwards compatibility with isopackets that still depend on
// babel-runtime rather than @babel/runtime.
"babel-runtime": "7.0.0-beta.3",
Expand Down
30 changes: 24 additions & 6 deletions tools/fs/optimistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,28 +354,46 @@ export const optimisticReadMeteorIgnore = wrap((dir: string) => {

type LookupPkgJsonType = OptimisticWrapperFunction<
[string, string],
ReturnType<typeof optimisticReadJsonOrNull>
ReturnType<typeof optimisticReadJsonOrNull>[]
>;

export const optimisticLookupPackageJson: LookupPkgJsonType =
// Returns an array of package.json objects encountered in any directory
// between relDir and absRootDir. If a package.json with a "name" property
// is found, it will always be the first object in the array.
export const optimisticLookupPackageJsonArray: LookupPkgJsonType =
wrap((absRootDir: string, relDir: string) => {
const absPkgJsonPath = pathJoin(absRootDir, relDir, "package.json");
const pkgJson = optimisticReadJsonOrNull(absPkgJsonPath);

// Named package.json files always terminate the search. This
// restriction was first introduced to fix #10547, before this function
// was updated to return an array instead of a single object, but
// returning here is still an important base case.
if (pkgJson && typeof pkgJson.name === "string") {
return pkgJson;
return [pkgJson];
}

const relParentDir = pathDirname(relDir);
if (relParentDir === relDir) {
return null;
return [];
}

// Stop searching if an ancestor node_modules directory is encountered.
if (pathBasename(relParentDir) === "node_modules") {
return null;
return [];
}

const parentArray =
optimisticLookupPackageJsonArray(absRootDir, relParentDir);

if (pkgJson) {
// If an intermediate package.json file was found, add its object to
// the array. Since these arrays are cached, we don't want to modify
// them using parentArray.push(pkgJson), hence concat.
return parentArray.concat(pkgJson);
}

return optimisticLookupPackageJson(absRootDir, relParentDir);
return parentArray;
});

const optimisticIsSymbolicLink = wrap((path: string) => {
Expand Down
50 changes: 44 additions & 6 deletions tools/isobuild/import-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
optimisticStatOrNull,
optimisticLStatOrNull,
optimisticHashOrNull,
optimisticLookupPackageJsonArray,
} from "../fs/optimistic";

import { wrap } from "optimism";
Expand Down Expand Up @@ -1294,7 +1295,7 @@ export default class ImportScanner {
// raw version found in node_modules. See also:
// https://github.com/meteor/meteor-feature-requests/issues/6

} else if (this.shouldUseNode(absModuleId)) {
} else if (this.shouldUseNode(absModuleId, absPath)) {
// On the server, modules in node_modules directories will be
// handled natively by Node, so we just need to generate a stub
// module that calls module.useNode(), rather than calling
Expand Down Expand Up @@ -1338,7 +1339,7 @@ export default class ImportScanner {

// Similar to logic in Module.prototype.useNode as defined in
// packages/modules-runtime/server.js. Introduced to fix issue #10122.
private shouldUseNode(absModuleId: string) {
private shouldUseNode(absModuleId: string, absPath: string) {
if (this.isWeb()) {
// Node should never be used in a browser, obviously.
return false;
Expand All @@ -1358,10 +1359,47 @@ export default class ImportScanner {
start += 2;
}

// If the remaining parts include node_modules, then this is a module
// that was installed by npm, and it should be evaluated by Node on
// the server.
return parts.indexOf("node_modules", start) >= 0;
// If the remaining parts do not include node_modules, then this
// module was not installed by npm, so we should not try to evaluate
// it natively in Node on the server.
if (parts.indexOf("node_modules", start) < 0) {
return false;
}

// Below this point, we know we're dealing with a module in
// node_modules, which means we should try to use module.useNode() to
// evaluate the module natively in Node, except if the module is an
// ESM module, because then the module cannot be imported using
// require (as of Node 12.16.0), so module.useNode() will not work.

const dotExt = pathExtname(absPath).toLowerCase();

if (dotExt === ".mjs") {
// Although few npm packages actually use .mjs, Node will always
// interpret these files as ESM modules, so we can return early.
return false;
}

if (dotExt === ".json") {
// There's no benefit to using Node to evaluate JSON modules, since
// there's nothing Node-specific about the parsing of JSON.
return false;
}

if (dotExt === ".js") {
const relDir = pathRelative(this.sourceRoot, pathDirname(absPath));
const pkgJsonArray =
optimisticLookupPackageJsonArray(this.sourceRoot, relDir);
// Setting "type":"module" in package.json makes Node treat .js
// files within the package as ESM modules.
if (pkgJsonArray.some(pkgJson => pkgJson?.type === "module")) {
return false;
}
}

// Everything else (.node, .wasm, whatever) needs to be handled
// natively by Node.
return true;
}

// Returns an absolute module identifier indicating where to install the
Expand Down
14 changes: 11 additions & 3 deletions tools/isobuild/package-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
optimisticHashOrNull,
optimisticStatOrNull,
optimisticReadMeteorIgnore,
optimisticLookupPackageJson,
optimisticLookupPackageJsonArray,
} from "../fs/optimistic";

// XXX: This is a medium-term hack, to avoid having the user set a package name
Expand Down Expand Up @@ -1287,8 +1287,16 @@ _.extend(PackageSource.prototype, {

let readOptions = sourceReadOptions;
if (inNodeModules) {
const pkgJson = optimisticLookupPackageJson(self.sourceRoot, dir);
if (pkgJson && nodeModulesToRecompile.has(pkgJson.name)) {
// This is an array because (in some rare cases) an npm package
// may have nested package.json files with additional properties.
const pkgJsonArray = optimisticLookupPackageJsonArray(self.sourceRoot, dir);

// If a package.json file with a "name" property is found, it will
// always be the first in the array.
const pkgJson = pkgJsonArray[0];

if (pkgJson && pkgJson.name &&
nodeModulesToRecompile.has(pkgJson.name)) {
// Avoid caching node_modules code recompiled by Meteor.
cacheKey = false;
} else {
Expand Down

0 comments on commit 34f8807

Please sign in to comment.