@live-codes/browser-compilers 0.7.3 → 0.7.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-codes/browser-compilers",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Compilers that run in the browser, for use in livecodes.io",
5
5
  "author": "Hatem Hosny",
6
6
  "license": "MIT",
@@ -51,6 +51,7 @@
51
51
  "@unocss/transformer-directives": "0.53.1",
52
52
  "@unocss/transformer-variant-group": "0.53.1",
53
53
  "@webassemblyjs/wast-refmt": "1.11.6",
54
+ "assemblyscript": "0.27.5",
54
55
  "autoprefixer": "10.4.14",
55
56
  "babel-preset-solid": "1.7.4",
56
57
  "cssnano-preset-default": "6.0.1",
@@ -71,9 +72,9 @@
71
72
  "react-dom": "18.2.0",
72
73
  "react-native-web": "0.19.4",
73
74
  "remark-gfm": "3.0.1",
74
- "sass": "1.63.2",
75
+ "sass": "1.63.6",
75
76
  "sucrase": "3.32.0",
76
- "svelte": "3.59.1",
77
+ "svelte": "4.0.0",
77
78
  "windicss": "3.5.6"
78
79
  },
79
80
  "devDependencies": {
@@ -162,7 +162,7 @@ patch('node_modules/@prettier/plugin-pug/dist/printer.js', {
162
162
  // svelte
163
163
  esbuild.buildSync({
164
164
  ...baseOptions,
165
- entryPoints: ['node_modules/svelte/compiler.js'],
165
+ entryPoints: ['node_modules/svelte/compiler.cjs'],
166
166
  outfile: 'dist/svelte/svelte-compiler.min.js',
167
167
  globalName: 'svelte',
168
168
  });
@@ -429,3 +429,43 @@ esbuild.build({
429
429
  outfile: 'dist/tailwindcss-plugins/tailwindcss-plugins.js',
430
430
  globalName: 'tailwindcssPlugins',
431
431
  });
432
+
433
+ // assemblyscript
434
+ esbuild
435
+ .build({
436
+ ...baseOptions,
437
+ entryPoints: ['vendor_modules/imports/assemblyscript.js'],
438
+ outfile: 'dist/assemblyscript/assemblyscript.esm.js',
439
+ format: 'esm',
440
+ plugins: nodePolyfills,
441
+ })
442
+ .then(() => {
443
+ // workaround for top level await in iife bundle
444
+ // https://github.com/evanw/esbuild/issues/253
445
+ const content = fs.readFileSync(
446
+ path.resolve('dist/assemblyscript/assemblyscript.esm.js'),
447
+ 'utf8',
448
+ );
449
+ const patchedContent =
450
+ 'self.assemblyscriptLoaded = (async() => {self.window = self;' +
451
+ content.replace(/export{(\w{1,3}) as asc};/g, (_, token) => {
452
+ return `self.assemblyscript={asc:${token}};})();`;
453
+ });
454
+ fs.writeFileSync(
455
+ path.resolve('dist/assemblyscript/assemblyscript.patched.js'),
456
+ patchedContent,
457
+ 'utf8',
458
+ );
459
+
460
+ esbuild
461
+ .build({
462
+ ...baseOptions,
463
+ entryPoints: ['dist/assemblyscript/assemblyscript.patched.js'],
464
+ outfile: 'dist/assemblyscript/assemblyscript.js',
465
+ platform: 'browser',
466
+ })
467
+ .then(() => {
468
+ fs.unlinkSync(path.resolve('dist/assemblyscript/assemblyscript.esm.js'));
469
+ fs.unlinkSync(path.resolve('dist/assemblyscript/assemblyscript.patched.js'));
470
+ });
471
+ });
@@ -4,6 +4,8 @@ This is a list of software packages with included source code (sorted alphabetic
4
4
 
5
5
  asciidoctor-skins: [MIT License](https://github.com/darshandsoni/asciidoctor-skins/blob/c98a8ab9b27571e5b63d75912a3c753cc72ed8e4/LICENSE)
6
6
 
7
+ AssemblyScript: [Apache License 2.0](https://github.com/AssemblyScript/assemblyscript/blob/a0c27fadd027a32542420160deff04dc31e10f59/LICENSE)
8
+
7
9
  Autoprefixer: [MIT License](https://github.com/postcss/autoprefixer/blob/61f71e9a8613b0c90357472d58fdcce26324ef4f/LICENSE)
8
10
 
9
11
  Civet: [MIT License](https://github.com/DanielXMoore/Civet/blob/9b28e3a351d130ce031c7b28b50bcb6d2a499315/LICENSE)
@@ -0,0 +1,3 @@
1
+ import asc from 'assemblyscript/dist/asc.js';
2
+
3
+ export { asc };