Visitar URL original
chore: add some hacks for Nova engine · ExodusOSS/test@cfd449a · GitHub
Skip to content

Commit cfd449a

Browse files
committed
chore: add some hacks for Nova engine
Refs: trynova/nova#933 Refs: trynova/nova#934
1 parent c88fef3 commit cfd449a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎bundler/bundle.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,24 @@ const loadPipeline = [
6565
} else if (filepath.endsWith('/node_modules/buffer/index.js')) {
6666
res = res.replace('.substr(i * 2, 2)', '.substring(i * 2, i * 2 + 2)')
6767
}
68+
} else if (options.platform === 'nova') {
69+
if (filepath.endsWith('/node_modules/get-intrinsic/index.js')) {
70+
// See https://github.com/trynova/nova/issues/933. Hacky, but should cover usage
71+
res = res.replace(
72+
String.raw`/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/`,
73+
String.raw`/[^%.\[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:[^\\"']|\\.)*?)["'])\]/`
74+
)
75+
} else if (
76+
filepath.endsWith('/node_modules/assert/build/assert.js') ||
77+
filepath.endsWith('/node_modules/assert/build/internal/assert/assertion_error.js') ||
78+
filepath.endsWith('/node_modules/assert/build/internal/errors.js') ||
79+
filepath.endsWith('/node_modules/assert/build/internal/util/comparisons.js')
80+
) {
81+
// See https://github.com/trynova/nova/issues/932
82+
for (const x of ['_setPrototypeOf', '_wrapNativeSuper', '_typeof']) {
83+
res = res.replace(`function ${x}(`, `var ${x} = function(`) // Once per name
84+
}
85+
}
6886
}
6987

7088
// Unneded polyfills

0 commit comments

Comments
 (0)