@maka/meteor-sdk 0.2.0 → 0.2.1

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.
Files changed (22) hide show
  1. package/isopackets/combined/npm/node_modules/meteor/babel-compiler/node_modules/.package-lock.json +1 -1
  2. package/isopackets/combined/npm/node_modules/meteor/boilerplate-generator/node_modules/.package-lock.json +1 -1
  3. package/isopackets/combined/npm/node_modules/meteor/constraint-solver/node_modules/.package-lock.json +1 -1
  4. package/isopackets/combined/npm/node_modules/meteor/ddp-client/node_modules/.package-lock.json +1 -1
  5. package/isopackets/combined/npm/node_modules/meteor/ecmascript/node_modules/.package-lock.json +1 -1
  6. package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime/node_modules/.package-lock.json +1 -1
  7. package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime-client/node_modules/.package-lock.json +1 -1
  8. package/isopackets/combined/npm/node_modules/meteor/ecmascript-runtime-server/node_modules/.package-lock.json +1 -1
  9. package/isopackets/combined/npm/node_modules/meteor/fetch/node_modules/.package-lock.json +1 -1
  10. package/isopackets/combined/npm/node_modules/meteor/inter-process-messaging/node_modules/.package-lock.json +1 -1
  11. package/isopackets/combined/npm/node_modules/meteor/logging/node_modules/.package-lock.json +1 -1
  12. package/isopackets/combined/npm/node_modules/meteor/logic-solver/node_modules/.package-lock.json +1 -1
  13. package/isopackets/combined/npm/node_modules/meteor/meteor/node_modules/.package-lock.json +1 -1
  14. package/isopackets/combined/npm/node_modules/meteor/modules/node_modules/.package-lock.json +1 -1
  15. package/isopackets/combined/npm/node_modules/meteor/modules-runtime/node_modules/.package-lock.json +1 -1
  16. package/isopackets/combined/npm/node_modules/meteor/npm-mongo/node_modules/.package-lock.json +1 -1
  17. package/isopackets/combined/npm/node_modules/meteor/package-version-parser/node_modules/.package-lock.json +1 -1
  18. package/isopackets/combined/npm/node_modules/meteor/promise/node_modules/.package-lock.json +1 -1
  19. package/isopackets/combined/npm/node_modules/meteor/react-fast-refresh/node_modules/.package-lock.json +1 -1
  20. package/isopackets/combined/npm/node_modules/meteor/socket-stream-client/node_modules/.package-lock.json +1 -1
  21. package/package.json +1 -1
  22. package/src/bootstrap.js +42 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-1a9ybnplxl6",
2
+ "name": "package-new-1r7dbz0c8wg",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-1cxei1c3068",
2
+ "name": "package-new-nktb6c4q13",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-ps05c2mn4yq",
2
+ "name": "package-new-c03yv5kvt5c",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-zmi4mtfem6",
2
+ "name": "package-new-1cnw8a67ov9",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-3uwfi7tvnl4",
2
+ "name": "package-new-1tf9jwmaca",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-e3ygl9xmtca",
2
+ "name": "package-new-10sya38usjv",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-11uo29brhyy",
2
+ "name": "package-new-3ivjp0fe2px",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-wmvme2targ",
2
+ "name": "package-new-1lw6fy3x045i",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-aiq3wg1fnh4",
2
+ "name": "package-new-18pj1q2114u",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-7xczjqu25zg",
2
+ "name": "package-new-13o6x1vmt33",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-v3g74kzrdds",
2
+ "name": "package-new-1og5l3im8lt",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-p264l39ugz",
2
+ "name": "package-new-iywg8a3j6ob",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-19m15y9vas4",
2
+ "name": "package-new-1gksx5vtdqd",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-omv1yo2tgcb",
2
+ "name": "package-new-iylmf9l00qp",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-nfwo8yl46tl",
2
+ "name": "package-new-5efm5qfjhvg",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-lt7vv4qibdd",
2
+ "name": "package-new-1d84t9k1ydz",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-18auvqzabjw",
2
+ "name": "package-new-1goqz676srul",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-hhy0n3bynw",
2
+ "name": "package-new-xw6nddmuwr",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-141jaq5t0vb",
2
+ "name": "package-new-owokmgbm4hl",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "package-new-1l73xtvblu7k",
2
+ "name": "package-new-16asc201r64",
3
3
  "lockfileVersion": 3,
4
4
  "requires": true,
5
5
  "packages": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maka/meteor-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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": {
package/src/bootstrap.js CHANGED
@@ -79,6 +79,47 @@ async function ensureRuntimeReady(offline) {
79
79
  await catalog.official.initialize({ offline: !!offline });
80
80
  }
81
81
 
82
+ // Compatibility shim for build plugins that introspect the running
83
+ // meteor-tool through `process.mainModule` -- zodern:types' bundled
84
+ // tools-imports.js is the known case in the wild: it does
85
+ // `process.mainModule.filename` to locate the tool's directory, then
86
+ // `process.mainModule.require(<abs path>)` to load isobuild/
87
+ // package-source, project-context, and packaging/tropohouse from it.
88
+ // Under the classic CLI that worked because the entry script was
89
+ // tools/index.js (CJS); an SDK host is typically an ESM entry (or some
90
+ // unrelated CJS file), where process.mainModule is undefined (or points
91
+ // somewhere useless), so any such plugin crashes with "Cannot read
92
+ // properties of undefined (reading 'filename')" while loading -- which
93
+ // also silently disables every file handler that plugin registers
94
+ // (e.g. zodern:types' *.d.ts handler, in turn breaking any package
95
+ // published with d.ts resources, like alanning:roles).
96
+ //
97
+ // The shim only fills in the undefined case (never clobbers a real CJS
98
+ // main module), with `filename` pointing into this package's own tools/
99
+ // (the index.js there need not exist -- plugins only dirname it) and a
100
+ // `require` that resolves the absolute paths plugins compute against
101
+ // it. Those are the exact same files this SDK itself requires, so the
102
+ // require cache serves back the same singletons the running tool uses.
103
+ // Note Node aliases newly-created CJS modules' `require.main` to
104
+ // process.mainModule at load time, so late-loaded CJS sees the shim
105
+ // there too -- harmless (nothing in tools/ reads either; audited).
106
+ function ensureMainModuleShim() {
107
+ if (process.mainModule) {
108
+ return;
109
+ }
110
+ const path = require("path");
111
+ const toolsDir = path.resolve(__dirname, "..", "tools");
112
+ process.mainModule = {
113
+ id: ".",
114
+ filename: path.join(toolsDir, "index.js"),
115
+ loaded: true,
116
+ exports: {},
117
+ children: [],
118
+ paths: [],
119
+ require: (request) => require(request),
120
+ };
121
+ }
122
+
82
123
  // Idempotent: safe to call from every public SDK entry point. The actual
83
124
  // Babel require() hook installed by install-babel.js is itself naturally
84
125
  // idempotent too (Node's own require() cache means requiring the same
@@ -107,6 +148,7 @@ async function bootstrap(options) {
107
148
  // Must happen before install-babel.js (or anything else) has a chance
108
149
  // to require tools/console/console.js -- see src/console.js's comment.
109
150
  consoleAdapter.setHeadlessEnv();
151
+ ensureMainModuleShim();
110
152
  require("../tools/tool-env/install-babel.js");
111
153
  ensureAsyncLocalStorage();
112
154
  consoleAdapter.patch();