@live-codes/browser-compilers 0.4.14 → 0.5.0
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/dist/autoprefixer/autoprefixer.js +42 -42
- package/dist/babel-preset-solid/babel-preset-solid.js +67 -17
- package/dist/mdx/mdx.js +48 -2348
- package/dist/postcss/postcss.js +18 -18
- package/dist/postcss-preset-env/postcss-preset-env.js +131 -1440
- package/dist/prettier/parser-pug.js +105 -105
- package/dist/remark-gfm/remark-gfm.js +14 -0
- package/dist/sass/sass.js +18 -18
- package/package.json +14 -10
- package/scripts/patch.js +25 -0
- package/scripts/vendors-module.mjs +21 -0
- package/scripts/vendors.js +44 -37
- package/vendor_modules/imports/babel-preset-solid.js +1 -1
- package/vendor_modules/imports/mdx.ts +1 -2
- package/vendor_modules/imports/remark-gfm.js +3 -0
- package/vendor_modules/src/stylus/readme.md +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-codes/browser-compilers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Compilers that run in the browser, for use in livecodes.io",
|
|
5
5
|
"author": "Hatem Hosny",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "live-server dist --port=8081 --no-browser --cors",
|
|
13
13
|
"build": "run-s clean build:vendors copy:types",
|
|
14
|
-
"build:vendors": "node ./scripts/vendors.js",
|
|
14
|
+
"build:vendors": "node ./scripts/vendors.js && node ./scripts/vendors-module.mjs",
|
|
15
15
|
"copy:types": "recursive-copy vendor_modules/types dist/types",
|
|
16
16
|
"gh-pages": "gh-pages -m \"[ci skip] Updates\" -d dist",
|
|
17
17
|
"fix": "run-s fix:*",
|
|
@@ -26,19 +26,22 @@
|
|
|
26
26
|
"prepush": "run-s fix build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@esbuild-plugins/node-globals-polyfill": "0.1.
|
|
30
|
-
"@esbuild-plugins/node-modules-polyfill": "0.1.
|
|
31
|
-
"@mdx-js/mdx": "
|
|
32
|
-
"@prettier/plugin-pug": "1.
|
|
29
|
+
"@esbuild-plugins/node-globals-polyfill": "0.1.1",
|
|
30
|
+
"@esbuild-plugins/node-modules-polyfill": "0.1.4",
|
|
31
|
+
"@mdx-js/mdx": "2.0.0",
|
|
32
|
+
"@prettier/plugin-pug": "1.19.2",
|
|
33
33
|
"@webassemblyjs/wast-refmt": "1.11.1",
|
|
34
|
-
"babel-preset-solid": "1.
|
|
34
|
+
"babel-preset-solid": "1.3.5",
|
|
35
|
+
"esbuild-plugin-cache": "0.2.9",
|
|
36
|
+
"esbuild-plugin-velcro": "0.1.1",
|
|
35
37
|
"less": "4.1.2",
|
|
36
38
|
"monaco-editor": "0.29.1",
|
|
37
|
-
"postcss": "8.
|
|
38
|
-
"postcss-preset-env": "
|
|
39
|
+
"postcss": "8.4.6",
|
|
40
|
+
"postcss-preset-env": "7.3.1",
|
|
39
41
|
"react": "17.0.2",
|
|
40
42
|
"react-dom": "17.0.2",
|
|
41
43
|
"react-native-web": "0.17.5",
|
|
44
|
+
"remark-gfm": "3.0.1",
|
|
42
45
|
"sass": "1.49.7",
|
|
43
46
|
"svelte": "3.44.1",
|
|
44
47
|
"windicss": "3.2.1"
|
|
@@ -49,9 +52,10 @@
|
|
|
49
52
|
"@types/prettier": "2.1.6",
|
|
50
53
|
"@typescript-eslint/eslint-plugin": "4.8.2",
|
|
51
54
|
"@typescript-eslint/parser": "4.8.2",
|
|
52
|
-
"autoprefixer": "10.4.
|
|
55
|
+
"autoprefixer": "10.4.2",
|
|
53
56
|
"cz-conventional-changelog": "3.2.0",
|
|
54
57
|
"esbuild": "0.11.12",
|
|
58
|
+
"esbuild-plugin-node-polyfills": "1.0.2",
|
|
55
59
|
"eslint": "7.32.0",
|
|
56
60
|
"eslint-config-prettier": "6.11.0",
|
|
57
61
|
"eslint-plugin-import": "2.20.2",
|
package/scripts/patch.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var fs = require('fs');
|
|
2
|
+
var path = require('path');
|
|
3
|
+
|
|
4
|
+
const patch = (
|
|
5
|
+
/** @type {string} */ filePath,
|
|
6
|
+
/** @type {Record<string, string>} */ replacements = {},
|
|
7
|
+
) =>
|
|
8
|
+
new Promise((resolve, reject) => {
|
|
9
|
+
fs.readFile(path.resolve(filePath), 'utf8', function (err, data) {
|
|
10
|
+
if (err) return reject(err);
|
|
11
|
+
|
|
12
|
+
var result = data;
|
|
13
|
+
for (const key of Object.keys(replacements)) {
|
|
14
|
+
result = result.replace(key, replacements[key]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fs.writeFile(path.resolve(filePath), result, 'utf8', function (err) {
|
|
18
|
+
if (err) return reject(err);
|
|
19
|
+
|
|
20
|
+
resolve();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
module.exports = { patch };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import esbuild from 'esbuild';
|
|
2
|
+
import { cache } from 'esbuild-plugin-cache';
|
|
3
|
+
|
|
4
|
+
/** @type {Partial<esbuild.BuildOptions>} */
|
|
5
|
+
const baseOptions = {
|
|
6
|
+
bundle: true,
|
|
7
|
+
minify: true,
|
|
8
|
+
format: 'iife',
|
|
9
|
+
define: { global: 'window', 'process.env.NODE_ENV': '"production"' },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// solid
|
|
13
|
+
esbuild.build({
|
|
14
|
+
...baseOptions,
|
|
15
|
+
entryPoints: ['vendor_modules/imports/babel-preset-solid.js'],
|
|
16
|
+
outfile: 'dist/babel-preset-solid/babel-preset-solid.js',
|
|
17
|
+
globalName: 'babelPresetSolid',
|
|
18
|
+
define: { global: 'window', 'process.env': '{}' },
|
|
19
|
+
|
|
20
|
+
plugins: [cache({})],
|
|
21
|
+
});
|
package/scripts/vendors.js
CHANGED
|
@@ -4,8 +4,13 @@ var path = require('path');
|
|
|
4
4
|
const esbuild = require('esbuild');
|
|
5
5
|
const NodeModulesPolyfills = require('@esbuild-plugins/node-modules-polyfill').default;
|
|
6
6
|
const GlobalsPolyfills = require('@esbuild-plugins/node-globals-polyfill').default;
|
|
7
|
+
// const ESBuildNodePolyfillsPlugin = require('esbuild-plugin-node-polyfills');
|
|
8
|
+
// const { createPlugin } = require('esbuild-plugin-velcro');
|
|
9
|
+
|
|
7
10
|
const Bundler = require('parcel-bundler');
|
|
8
11
|
|
|
12
|
+
const { patch } = require('./patch');
|
|
13
|
+
|
|
9
14
|
const nodePolyfills = [
|
|
10
15
|
NodeModulesPolyfills(),
|
|
11
16
|
GlobalsPolyfills({
|
|
@@ -65,24 +70,15 @@ entryFiles.forEach(async (file) => {
|
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
// sass
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (err) return console.log(err);
|
|
78
|
-
|
|
79
|
-
esbuild.build({
|
|
80
|
-
...baseOptions,
|
|
81
|
-
entryPoints: ['vendor_modules/imports/sass.ts'],
|
|
82
|
-
outfile: 'dist/sass/sass.js',
|
|
83
|
-
globalName: 'sass',
|
|
84
|
-
plugins: nodePolyfills,
|
|
85
|
-
});
|
|
73
|
+
patch('node_modules/sass/sass.dart.js', {
|
|
74
|
+
'var self = Object.create(dartNodePreambleSelf);': 'var self = window;',
|
|
75
|
+
}).then(() => {
|
|
76
|
+
esbuild.build({
|
|
77
|
+
...baseOptions,
|
|
78
|
+
entryPoints: ['vendor_modules/imports/sass.ts'],
|
|
79
|
+
outfile: 'dist/sass/sass.js',
|
|
80
|
+
globalName: 'sass',
|
|
81
|
+
plugins: nodePolyfills,
|
|
86
82
|
});
|
|
87
83
|
});
|
|
88
84
|
|
|
@@ -134,14 +130,21 @@ esbuild.build({
|
|
|
134
130
|
});
|
|
135
131
|
|
|
136
132
|
// postcss-preset-env
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
patch('node_modules/postcss-custom-properties/dist/index.mjs', {
|
|
134
|
+
'import{pathToFileURL as r}from"url";': 'const r = (path) => new URL(path, "file:");',
|
|
135
|
+
'import{promises as s}from"fs";':
|
|
136
|
+
'const s = { writeFile: async () => {}, readFile: async () => "" };',
|
|
137
|
+
}).then(() => {
|
|
138
|
+
esbuild.build({
|
|
139
|
+
...baseOptions,
|
|
140
|
+
entryPoints: ['vendor_modules/imports/postcss-preset-env.ts'],
|
|
141
|
+
outfile: 'dist/postcss-preset-env/postcss-preset-env.js',
|
|
142
|
+
globalName: 'postcssPresetEnv',
|
|
143
|
+
plugins: nodePolyfills,
|
|
144
|
+
});
|
|
143
145
|
});
|
|
144
146
|
|
|
147
|
+
// @prettier/plugin-pug
|
|
145
148
|
esbuild.buildSync({
|
|
146
149
|
...baseOptions,
|
|
147
150
|
entryPoints: ['node_modules/@prettier/plugin-pug/dist/index.js'],
|
|
@@ -149,15 +152,6 @@ esbuild.buildSync({
|
|
|
149
152
|
globalName: 'pluginPug',
|
|
150
153
|
});
|
|
151
154
|
|
|
152
|
-
// solid
|
|
153
|
-
esbuild.build({
|
|
154
|
-
...baseOptions,
|
|
155
|
-
entryPoints: ['vendor_modules/imports/babel-preset-solid.js'],
|
|
156
|
-
outfile: 'dist/babel-preset-solid/babel-preset-solid.js',
|
|
157
|
-
globalName: 'babelPresetSolid',
|
|
158
|
-
plugins: nodePolyfills,
|
|
159
|
-
});
|
|
160
|
-
|
|
161
155
|
// svelte
|
|
162
156
|
esbuild.buildSync({
|
|
163
157
|
...baseOptions,
|
|
@@ -174,12 +168,25 @@ fs.copyFileSync(
|
|
|
174
168
|
);
|
|
175
169
|
|
|
176
170
|
// MDX
|
|
171
|
+
patch('node_modules/@mdx-js/mdx/lib/plugin/recma-document.js', {
|
|
172
|
+
"import {URL} from 'url'": '',
|
|
173
|
+
}).then(() => {
|
|
174
|
+
esbuild.build({
|
|
175
|
+
...baseOptions,
|
|
176
|
+
entryPoints: ['vendor_modules/imports/mdx.ts'],
|
|
177
|
+
outfile: 'dist/mdx/mdx.js',
|
|
178
|
+
format: 'esm',
|
|
179
|
+
define: { window: 'globalThis' },
|
|
180
|
+
plugins: nodePolyfills,
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// remark-gfm
|
|
177
185
|
esbuild.build({
|
|
178
186
|
...baseOptions,
|
|
179
|
-
entryPoints: ['vendor_modules/imports/
|
|
180
|
-
outfile: 'dist/
|
|
181
|
-
|
|
182
|
-
plugins: nodePolyfills,
|
|
187
|
+
entryPoints: ['vendor_modules/imports/remark-gfm.js'],
|
|
188
|
+
outfile: 'dist/remark-gfm/remark-gfm.js',
|
|
189
|
+
format: 'esm',
|
|
183
190
|
});
|
|
184
191
|
|
|
185
192
|
// livescript
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import solid from 'babel-preset-solid';
|
|
1
|
+
import solid from 'https://esm.sh/babel-preset-solid@1.3.5';
|
|
2
2
|
export { solid };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { mdx };
|
|
1
|
+
export { compile } from '@mdx-js/mdx';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from https://github.com/stylus/stylus-lang.com/blob/gh-pages/try/stylus.min.js
|