-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
remove workers node compatibility layer
Showing
10 changed files
with
194 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
raiplayrss | ||
========== | ||
|
||
`npm run build-podcast` to build the intermediate `podcast` lib. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
index.js | ||
types | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Podcast dependency gets inserted here so that we don't need any Node libraries to run the site. | ||
|
||
Currently, the podcast lib we use depends on Node for a few things. We can just compile a version with stubs and we should be good to go. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { readFileSync, writeFileSync } from "node:fs"; | ||
import { cp } from "node:fs/promises"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import { build } from "esbuild"; | ||
import { polyfillNode } from "esbuild-plugin-polyfill-node"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const entrypointPath = path.join( | ||
__dirname, | ||
"../node_modules/podcast/dist/esm/index.js", | ||
); | ||
const podcastOutPath = path.join(__dirname, "../build/podcast/index.js"); | ||
const typesPath = path.join(__dirname, "../node_modules/podcast/dist/types"); | ||
const typesOutPath = path.join(__dirname, "../build/podcast/types"); | ||
|
||
const copyP = cp(typesPath, typesOutPath, { recursive: true }); | ||
|
||
const buildP = build({ | ||
entryPoints: [entrypointPath], | ||
bundle: true, | ||
format: "esm", | ||
outfile: podcastOutPath, | ||
plugins: [polyfillNode({})], | ||
}); | ||
|
||
await Promise.all([copyP, buildP]); | ||
|
||
// this is a horrible hack for some kind of showstopper bug in the output | ||
const outputFileContent = readFileSync(podcastOutPath, "utf-8"); | ||
const fixedContent = outputFileContent | ||
.replace("self.TextEncoder", "globalThis.TextEncoder") | ||
.replace("self.TextDecoder", "globalThis.TextDecoder"); | ||
writeFileSync(podcastOutPath, fixedContent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "@tsconfig/node21/tsconfig.json", | ||
"compilerOptions": { | ||
"module": "nodenext", | ||
"resolveJsonModule": true, | ||
"noEmit": true | ||
}, | ||
"include": ["*.ts"] | ||
} |