@devvit/build-pack 0.12.0-next-2025-04-12-5721a9506.0 → 0.12.0-next-2025-04-24-137462f28.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BundleModule.d.ts","sourceRoot":"","sources":["../../src/esbuild/BundleModule.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAM7D;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAUxF;AAyCD,cAAM,aAAc,SAAQ,KAAK;gBACnB,GAAG,EAAE,MAAM;CAGxB;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"BundleModule.d.ts","sourceRoot":"","sources":["../../src/esbuild/BundleModule.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAqB7D;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAUxF;AAyCD,cAAM,aAAc,SAAQ,KAAK;gBACnB,GAAG,EAAE,MAAM;CAGxB;AAED,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG,OAAO,aAAa,CAAC"}
@@ -4,6 +4,20 @@ import { Actor } from '@devvit/shared-types/Actor.js';
4
4
  // Define require for server builds which may have externalized dependencies.
5
5
  // ESM does not define require but bundles are CJS and evaluated inline .
6
6
  globalThis.require ??= createRequire(import.meta.url);
7
+ // because we evaluate the code to create the actor bundle webbit apps fail because they cannot
8
+ // open their HTTP port. This overrides http.createServer().listen(), so it's a no-op
9
+ const webbitBundlingHack = `
10
+ const http = require('http');
11
+ const createServer = http.createServer;
12
+ http.createServer = () => {
13
+ const srv = createServer();
14
+ srv.listen = () => {};
15
+ return srv;
16
+ };
17
+ `;
18
+ const webbitBundlingHackRevert = `
19
+ http.createServer = createServer;
20
+ `;
7
21
  /**
8
22
  * Dangerously executes untrusted code and returns the Actor class. An Error is
9
23
  * thrown if the code does not adhere to the BundleModule interface.
@@ -39,7 +53,7 @@ async function dangerouslyGetBundleDefaultExport(code) {
39
53
  // JS please forgive us
40
54
  // TODO DX-63
41
55
  // eslint-disable-next-line security/detect-eval-with-expression
42
- eval(code);
56
+ eval(webbitBundlingHack + code + webbitBundlingHackRevert);
43
57
  return module.exports?.default;
44
58
  }
45
59
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -372,7 +372,58 @@ function esbuildConfig(disableExternDevvitProtos, targetRuntime, watchMode = fal
372
372
  return {
373
373
  // Recursively inline any imported dependencies.
374
374
  bundle: true,
375
- external: ['node:*'],
375
+ external: [
376
+ 'node:*',
377
+ // All .js files from https://github.com/nodejs/node/tree/b2405e9/lib that
378
+ // don't start with _. Another option is to mark everything external for
379
+ // server builds but then the user can't bundle _anything_.
380
+ 'assert',
381
+ 'async_hooks',
382
+ 'buffer',
383
+ 'child_process',
384
+ 'cluster',
385
+ 'console',
386
+ 'constants',
387
+ 'crypto',
388
+ 'dgram',
389
+ 'diagnostics_channel',
390
+ 'dns',
391
+ 'domain',
392
+ 'events',
393
+ 'fs',
394
+ 'http',
395
+ 'http2',
396
+ 'https',
397
+ 'inspector',
398
+ 'module',
399
+ 'net',
400
+ 'os',
401
+ 'path',
402
+ 'perf_hooks',
403
+ 'process',
404
+ 'punycode',
405
+ 'querystring',
406
+ 'quic',
407
+ 'readline',
408
+ 'repl',
409
+ 'sea',
410
+ 'sqlite',
411
+ 'stream',
412
+ 'string_decoder',
413
+ 'sys',
414
+ 'test',
415
+ 'timers',
416
+ 'tls',
417
+ 'trace_events',
418
+ 'tty',
419
+ 'url',
420
+ 'util',
421
+ 'v8',
422
+ 'vm',
423
+ 'wasi',
424
+ 'worker_threads',
425
+ 'zlib',
426
+ ],
376
427
  // Split the @devvit/protos from the LinkedBundle. This means apps assume
377
428
  // @devvit/protos is available for import at execution time.
378
429
  plugins: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/build-pack",
3
- "version": "0.12.0-next-2025-04-12-5721a9506.0",
3
+ "version": "0.12.0-next-2025-04-24-137462f28.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "types": "./index.d.ts",
25
25
  "dependencies": {
26
- "@devvit/protos": "0.12.0-next-2025-04-12-5721a9506.0",
27
- "@devvit/shared-types": "0.12.0-next-2025-04-12-5721a9506.0",
26
+ "@devvit/protos": "0.12.0-next-2025-04-24-137462f28.0",
27
+ "@devvit/shared-types": "0.12.0-next-2025-04-24-137462f28.0",
28
28
  "esbuild": "0.23.0",
29
29
  "rxjs": "7.8.1",
30
30
  "tiny-glob": "0.2.9",
@@ -32,17 +32,17 @@
32
32
  "typescript": "5.3.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@devvit/public-api": "0.12.0-next-2025-04-12-5721a9506.0",
36
- "@devvit/repo-tools": "0.12.0-next-2025-04-12-5721a9506.0",
37
- "@devvit/tsconfig": "0.12.0-next-2025-04-12-5721a9506.0",
35
+ "@devvit/public-api": "0.12.0-next-2025-04-24-137462f28.0",
36
+ "@devvit/repo-tools": "0.12.0-next-2025-04-24-137462f28.0",
37
+ "@devvit/tsconfig": "0.12.0-next-2025-04-24-137462f28.0",
38
38
  "@types/tsv": "0.2.1",
39
39
  "eslint": "9.11.1",
40
40
  "typescript": "5.3.2",
41
- "vitest": "1.6.0"
41
+ "vitest": "1.6.1"
42
42
  },
43
43
  "publishConfig": {
44
44
  "directory": "dist"
45
45
  },
46
46
  "source": "./src/index.ts",
47
- "gitHead": "fa2e1667b35f959df42b8c0ef56f3e5e47565d39"
47
+ "gitHead": "6c680b1ce74f21ae0200dc527053c7382e75fd58"
48
48
  }