discourse/patches/content-tag@2.0.1.patch
David Taylor 80b9c280ba
DEV: Switch to pnpm for JS dependencies (#28671)
This will bring significant improvements to install speed & storage requirements. For information on how it may affect you, see https://meta.discourse.org/t/324521

This commit:
- removes the `yarn.lock` and replaces with `pnpm-lock.yaml`
- updates workspaces to pnpm format
- adjusts package dependencies to work with pnpm's stricter resolution strategy
- updates Rails app to load modules from more specific node_modules directories
- adds a `.pnpmfile` which automatically cleans up old yarn-managed `node_modules` directories
- updates various scripts to call `pnpm` instead of `yarn`
- updates patches to use pnpm's native patch system instead of patch-package
- adds a patch for licensee to support pnpm
2024-09-03 10:51:07 +01:00

28 lines
1.0 KiB
Diff

diff --git a/pkg/standalone.js b/pkg/standalone.js
index 7be08fc..35777bf 100644
--- a/pkg/standalone.js
+++ b/pkg/standalone.js
@@ -1,7 +1,8 @@
-import init from "./standalone/content_tag.js";
+import { initSync } from "./standalone/content_tag.js";
+import module from "./standalone/content_tag_bg.wasm";
import { Preprocessor as WasmPreprocessor } from "./standalone/content_tag.js";
-await init();
+initSync(module);
const defaultOptions = {
inline_source_map: false,
diff --git a/pkg/standalone/content_tag.js b/pkg/standalone/content_tag.js
index aaefe00..bb20026 100644
--- a/pkg/standalone/content_tag.js
+++ b/pkg/standalone/content_tag.js
@@ -20,6 +20,7 @@ function takeObject(idx) {
return ret;
}
+const { TextDecoder, TextEncoder } = require('util');
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };