@maka/meteor-sdk 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/isopackets/combined/npm/node_modules/meteor/babel-compiler/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/boilerplate-generator/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/constraint-solver/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/ddp-client/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/ecmascript/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime-client/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime-server/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/fetch/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/inter-process-messaging/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/logging/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/logic-solver/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/meteor/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/modules/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/modules-runtime/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/npm-mongo/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/package-version-parser/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/promise/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/react-fast-refresh/node_modules/.package-lock.json +1 -1
- package/isopackets/combined/npm/node_modules/meteor/socket-stream-client/node_modules/.package-lock.json +1 -1
- package/package.json +2 -5
- package/src/release.js +37 -1
- package/tools/fs/dev-bundle-links.js +1 -1
- package/tools/fs/files.ts +20 -7
package/README.md
CHANGED
|
@@ -42,6 +42,15 @@ the target app's own `.meteor/release` (e.g. `"METEOR@3.5.1"`) -- it pins
|
|
|
42
42
|
which Meteor release's package versions and build behavior this process
|
|
43
43
|
uses.
|
|
44
44
|
|
|
45
|
+
Passing a specific release requires that release to be present in the
|
|
46
|
+
local package catalog (the Meteor warehouse) -- on a machine that has
|
|
47
|
+
never downloaded it, `init` rejects with a `MeteorSdkError` naming the
|
|
48
|
+
missing release. **Embedders that only need `connectDdp()` (or other
|
|
49
|
+
non-build APIs) should call `init({})` with no release**: that uses
|
|
50
|
+
checkout semantics (the tool copy this package itself ships), needs no
|
|
51
|
+
warehouse or catalog access, and works on a machine whose only Meteor
|
|
52
|
+
footprint is this npm package.
|
|
53
|
+
|
|
45
54
|
### `loadProject(appDir)`
|
|
46
55
|
|
|
47
56
|
Resolves an app directory into a `Project`, ready to bundle or run.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/meteor-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Programmatic Node API over the Meteor build tool (bundle/run/create/etc.) -- for driving Meteor's build system from plain Node code instead of shelling out to a meteor CLI (there isn't one anymore; see README.md). \"dependencies\" is generated by scripts/write-tool-package-json.js from scripts/dev-bundle-tool-package.js at the monorepo root -- do not hand-edit that field, edit that file and re-run the script instead.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -45,9 +45,7 @@
|
|
|
45
45
|
"@types/semver": "7.5.8",
|
|
46
46
|
"semver": "7.6.3",
|
|
47
47
|
"request": "2.88.2",
|
|
48
|
-
"uuid": "8.3.2",
|
|
49
48
|
"graceful-fs": "4.2.11",
|
|
50
|
-
"tar": "6.1.11",
|
|
51
49
|
"tar-fs": "2.1.1",
|
|
52
50
|
"source-map": "0.7.4",
|
|
53
51
|
"chalk": "4.1.2",
|
|
@@ -56,8 +54,7 @@
|
|
|
56
54
|
"is-reachable": "3.1.0",
|
|
57
55
|
"wordwrap": "1.0.0",
|
|
58
56
|
"moment": "2.30.1",
|
|
59
|
-
"
|
|
60
|
-
"glob": "11.0.1",
|
|
57
|
+
"glob": "11.1.0",
|
|
61
58
|
"ignore": "7.0.5",
|
|
62
59
|
"commonmark": "0.15.0",
|
|
63
60
|
"escope": "4.0.0",
|
package/src/release.js
CHANGED
|
@@ -36,7 +36,43 @@ async function init(options) {
|
|
|
36
36
|
// release cached (or be reachable); see release.load's own doc comment
|
|
37
37
|
// in meteor-tool for the exact fetch/cache behavior.
|
|
38
38
|
const releaseName = options.release == null ? null : options.release;
|
|
39
|
-
|
|
39
|
+
let releaseObject;
|
|
40
|
+
try {
|
|
41
|
+
releaseObject = await release.load(releaseName);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// release.NoSuchReleaseError is an EMPTY constructor -- not even an
|
|
44
|
+
// Error, no .message -- so embedders logging err.message printed
|
|
45
|
+
// "undefined" and the real cause (release not in the local package
|
|
46
|
+
// catalog, e.g. a machine with no populated Meteor warehouse) was
|
|
47
|
+
// invisible. Cost a real debugging evening in the field; wrap it
|
|
48
|
+
// (and any other message-less throw from release.load) in a proper
|
|
49
|
+
// MeteorSdkError that names the release and where the catalog lives.
|
|
50
|
+
let warehouse = "~/.meteor";
|
|
51
|
+
try {
|
|
52
|
+
warehouse = require("../tools/packaging/tropohouse.js").default.root;
|
|
53
|
+
} catch (_) {
|
|
54
|
+
// Best effort -- the default hint above is close enough.
|
|
55
|
+
}
|
|
56
|
+
if (e instanceof release.NoSuchReleaseError) {
|
|
57
|
+
throw new MeteorSdkError(
|
|
58
|
+
"init(): release " + JSON.stringify(releaseName) + " is not in " +
|
|
59
|
+
"the local package catalog (warehouse: " + warehouse + "). " +
|
|
60
|
+
"On a machine that has never downloaded that Meteor release " +
|
|
61
|
+
"this is expected -- either install/download the release " +
|
|
62
|
+
"first, or, for embedders that only need connectDdp() and " +
|
|
63
|
+
"other non-build APIs, call init({}) with no release (checkout " +
|
|
64
|
+
"semantics, no catalog needed)."
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
if (e instanceof Error) {
|
|
68
|
+
throw e;
|
|
69
|
+
}
|
|
70
|
+
throw new MeteorSdkError(
|
|
71
|
+
"init(): release.load(" + JSON.stringify(releaseName) + ") failed " +
|
|
72
|
+
"with a message-less throw (" + Object.prototype.toString.call(e) +
|
|
73
|
+
"); warehouse: " + warehouse
|
|
74
|
+
);
|
|
75
|
+
}
|
|
40
76
|
// forced is always true: init({release}) is the embedder explicitly
|
|
41
77
|
// choosing the release for this process -- the moral equivalent of the
|
|
42
78
|
// CLI's --release flag, which is exactly what release.forced means.
|
|
@@ -22,7 +22,7 @@ exports.makeLink = function (target, linkPath) {
|
|
|
22
22
|
fs.renameSync(tempPath, linkPath);
|
|
23
23
|
} catch (e) {
|
|
24
24
|
// If renaming fails, try unlinking first.
|
|
25
|
-
require("
|
|
25
|
+
require("fs").rmSync(linkPath, { recursive: true, force: true });
|
|
26
26
|
fs.renameSync(tempPath, linkPath);
|
|
27
27
|
}
|
|
28
28
|
};
|
package/tools/fs/files.ts
CHANGED
|
@@ -30,7 +30,6 @@ import { realpathSync } from './fsFixPath';
|
|
|
30
30
|
|
|
31
31
|
const _ = require('underscore');
|
|
32
32
|
|
|
33
|
-
const rimraf = require('rimraf');
|
|
34
33
|
const sourcemap = require('source-map');
|
|
35
34
|
const sourceMapRetrieverStack = require('../tool-env/source-map-retriever-stack.js');
|
|
36
35
|
|
|
@@ -322,7 +321,16 @@ export function getCurrentNodeBinDir() {
|
|
|
322
321
|
// Return the top-level directory for this meteor install or checkout
|
|
323
322
|
export function getCurrentToolsDir() {
|
|
324
323
|
if (!process.env.SANDBOX && process.env.METEOR_WAREHOUSE_DIR) {
|
|
325
|
-
|
|
324
|
+
// Only follow the warehouse's `meteor` link when it actually exists:
|
|
325
|
+
// an empty/fresh METEOR_WAREHOUSE_DIR (observed: SDK embedders
|
|
326
|
+
// pointing the env var at a scratch dir) made realpathSync throw
|
|
327
|
+
// ENOENT uncaught through getToolBundleRoot() and everything above
|
|
328
|
+
// it. Falling through to the __dirname-based answer keeps the
|
|
329
|
+
// running tool copy resolvable regardless of warehouse state.
|
|
330
|
+
const warehouseMeteor = pathJoin(process.env.METEOR_WAREHOUSE_DIR, 'meteor');
|
|
331
|
+
if (exists(warehouseMeteor)) {
|
|
332
|
+
return pathDirname(realpathSync(warehouseMeteor));
|
|
333
|
+
}
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
return pathDirname(pathDirname(convertToStandardPath(__dirname)));
|
|
@@ -457,16 +465,21 @@ export function realpathOrNull(path: string) {
|
|
|
457
465
|
|
|
458
466
|
export function rm_recursive_async(path: string) {
|
|
459
467
|
return new Promise<void>((resolve, reject) => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
468
|
+
// fs.rm with force+maxRetries replaces the old rimraf dependency
|
|
469
|
+
// (Node's built-in grew the same EPERM/EBUSY retry behavior it
|
|
470
|
+
// existed for).
|
|
471
|
+
fs.rm(
|
|
472
|
+
convertToOSPath(path),
|
|
473
|
+
{ recursive: true, force: true, maxRetries: 3 },
|
|
474
|
+
(err) => err ? reject(err) : resolve()
|
|
475
|
+
);
|
|
463
476
|
});
|
|
464
477
|
}
|
|
465
478
|
|
|
466
479
|
// Like rm -r.
|
|
467
480
|
export const rm_recursive = Profile("files.rm_recursive", async (path: string) => {
|
|
468
481
|
try {
|
|
469
|
-
|
|
482
|
+
fs.rmSync(convertToOSPath(path), { recursive: true, force: true });
|
|
470
483
|
} catch (e: any) {
|
|
471
484
|
if ((e.code === "ENOTEMPTY" ||
|
|
472
485
|
e.code === "EPERM")) {
|
|
@@ -1734,7 +1747,7 @@ export const rename = isWindowsLikeFilesystem() ? function (from: string, to: st
|
|
|
1734
1747
|
// Despite previous failures, the top-level destination directory
|
|
1735
1748
|
// may have been successfully created, so we must remove it to
|
|
1736
1749
|
// avoid moving the source file *into* the destination directory.
|
|
1737
|
-
|
|
1750
|
+
fs.rmSync(osTo, { recursive: true, force: true });
|
|
1738
1751
|
wrappedRename(from, to);
|
|
1739
1752
|
resolve();
|
|
1740
1753
|
} catch (err: any) {
|