@live-codes/browser-compilers 0.7.2 → 0.7.4

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.2",
3
+ "version": "0.7.4",
4
4
  "description": "Compilers that run in the browser, for use in livecodes.io",
5
5
  "author": "Hatem Hosny",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "@esbuild-plugins/node-modules-polyfill": "0.1.4",
28
28
  "@fullhuman/postcss-purgecss": "5.0.0",
29
29
  "@mdx-js/mdx": "2.3.0",
30
- "@prettier/plugin-pug": "2.4.0",
30
+ "@prettier/plugin-pug": "2.5.1",
31
31
  "@tailwindcss/aspect-ratio": "0.4.2",
32
32
  "@tailwindcss/forms": "0.5.3",
33
33
  "@tailwindcss/line-clamp": "0.4.4",
@@ -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",
@@ -145,13 +145,19 @@ patch('node_modules/browserslist/index.js', {
145
145
  });
146
146
  });
147
147
 
148
- // @prettier/plugin-pug
149
- esbuild.buildSync({
150
- ...baseOptions,
151
- entryPoints: ['node_modules/@prettier/plugin-pug/dist/index.js'],
152
- outfile: 'dist/prettier/parser-pug.js',
153
- globalName: 'pluginPug',
154
- });
148
+ patch('node_modules/@prettier/plugin-pug/dist/printer.js', {
149
+ 'const node_util_1 = require("node:util");':
150
+ 'const node_util_1 = {types: {isNativeError: () => false}};',
151
+ }).then(() =>
152
+ // @prettier/plugin-pug
153
+ esbuild.build({
154
+ ...baseOptions,
155
+ entryPoints: ['node_modules/@prettier/plugin-pug/dist/index.js'],
156
+ outfile: 'dist/prettier/parser-pug.js',
157
+ globalName: 'pluginPug',
158
+ plugins: nodePolyfills,
159
+ }),
160
+ );
155
161
 
156
162
  // svelte
157
163
  esbuild.buildSync({
@@ -423,3 +429,31 @@ esbuild.build({
423
429
  outfile: 'dist/tailwindcss-plugins/tailwindcss-plugins.js',
424
430
  globalName: 'tailwindcssPlugins',
425
431
  });
432
+
433
+ // assemblyscript
434
+ esbuild.build({
435
+ ...baseOptions,
436
+ entryPoints: ['vendor_modules/imports/assemblyscript.js'],
437
+ outfile: 'dist/assemblyscript/assemblyscript.esm.js',
438
+ format: 'esm',
439
+ plugins: nodePolyfills,
440
+ }).then(() => {
441
+ // workaround for top level await in iife bundle
442
+ // https://github.com/evanw/esbuild/issues/253
443
+ const content = fs.readFileSync(path.resolve('dist/assemblyscript/assemblyscript.esm.js'), 'utf8');
444
+ const patchedContent = 'self.assemblyscriptLoaded = (async() => {self.window = self;' +
445
+ content.replace(/export{(\w{1,3}) as asc};/g, (_, token) => {
446
+ return `self.assemblyscript={asc:${token}};})();`;
447
+ });
448
+ fs.writeFileSync(path.resolve('dist/assemblyscript/assemblyscript.patched.js'), patchedContent, 'utf8');
449
+
450
+ esbuild.build({
451
+ ...baseOptions,
452
+ entryPoints: ['dist/assemblyscript/assemblyscript.patched.js'],
453
+ outfile: 'dist/assemblyscript/assemblyscript.js',
454
+ platform: 'browser',
455
+ }).then(() => {
456
+ fs.unlinkSync(path.resolve('dist/assemblyscript/assemblyscript.esm.js'));
457
+ fs.unlinkSync(path.resolve('dist/assemblyscript/assemblyscript.patched.js'));
458
+ });
459
+ });
@@ -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 };