Skip to content

Commit 55cbb93

Browse files
authored
Merge pull request #67 from socketsupply/remove-esbuild
Remove esbuild
2 parents bd8b218 + ee53d8c commit 55cbb93

File tree

20 files changed

+14794
-308441
lines changed

20 files changed

+14794
-308441
lines changed

build.js

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
#!/usr/bin/env node
2-
import path from 'node:path'
3-
import fs from 'node:fs/promises'
4-
2+
//
3+
// Most newer modules don't need to be bundled. But the monaco
4+
// and xterm packages rely on bundler-features heavily.
5+
//
56
import esbuild from 'esbuild'
67

7-
const __dirname = path.dirname(new URL(import.meta.url).pathname)
8-
9-
const cp = async (a, b) => fs.cp(
10-
path.resolve(a),
11-
path.join(b, path.basename(a)),
12-
{ recursive: true, force: true }
13-
)
14-
15-
async function copy (target) {
16-
await cp('src/index.html', target)
17-
await cp('src/vm.js', target)
18-
await cp('src/preview.js', target)
19-
await cp('src/worker.js', target)
20-
await cp('icons/icon.png', target)
21-
await cp('src/settings.json', target)
22-
await cp('src/fonts', target)
23-
await cp('src/lib', target)
24-
await cp('src/pages', target)
25-
await cp('src/css', target)
26-
}
27-
288
async function main (argv) {
299
const workerEntryPoints = [
3010
'vs/language/json/json.worker.js',
@@ -37,25 +17,25 @@ async function main (argv) {
3717
await esbuild.build({
3818
entryPoints: workerEntryPoints.map((entry) => `node_modules/monaco-editor/esm/${entry}`),
3919
bundle: true,
40-
minify: false,
20+
minify: true,
4121
format: 'iife',
4222
outbase: 'node_modules/monaco-editor/esm/',
4323
outdir: 'src/lib'
4424
})
4525

4626
const params = {
47-
entryPoints: ['src/index.js'],
27+
entryPoints: ['src/vendor.js'],
4828
format: 'esm',
4929
bundle: true,
50-
minify: false,
30+
minify: true,
5131
sourcemap: false,
52-
external: ['socket:*', 'node:*'],
5332
loader: {
5433
'.ttf': 'file'
5534
}
5635
}
5736

5837
const target = process.env.PREFIX
38+
5939
if (!target) {
6040
console.log('This script should not be run directly. It will be run by the SSC command.')
6141
process.exit(0)
@@ -65,8 +45,8 @@ async function main (argv) {
6545
...params,
6646
outdir: target
6747
}
48+
6849
await esbuild.build(opts)
69-
await copy(target)
7050
}
7151

7252
main(process.argv.slice(2))

importmap.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"imports": {
3+
"@socketsupply/tonic": "npm:@socketsupply/tonic",
4+
"@socketsupply/components": "npm:@socketsupply/components",
5+
"@socketsupply/components/dialog": "npm:@socketsupply/components/dialog",
6+
"@socketsupply/indexed": "npm:@socketsupply/indexed"
7+
}
8+
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
"type": "git"
1010
},
1111
"devDependencies": {
12-
"@socketsupply/components": "^14.0.13",
13-
"@socketsupply/indexed": "^1.0.3",
14-
"@socketsupply/tonic": "^15.1.2",
15-
"esbuild": "^0.20.0",
1612
"monaco-editor": "^0.46.0",
17-
"standard": "^17.1.0",
1813
"xterm": "^5.3.0",
1914
"xterm-addon-fit": "^0.8.0",
20-
"xterm-addon-search": "^0.13.0"
15+
"xterm-addon-search": "^0.13.0",
16+
"esbuild": "^0.20.0",
17+
"standard": "^17.1.0"
2118
},
2219
"scripts": {
2320
"build": "ssc build -r -o",
@@ -27,6 +24,9 @@
2724
"author": "Socket Supply Co. <[email protected]>",
2825
"license": "MIT",
2926
"dependencies": {
27+
"@socketsupply/indexed": "^1.0.3",
28+
"@socketsupply/tonic": "^15.1.2",
29+
"@socketsupply/components": "^14.1.0",
3030
"@socketsupply/socket": "^0.5.4"
3131
}
3232
}

socket.ini

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,38 @@ script = "node build.js"
5353
DEV = true
5454

5555

56+
[build.copy-map]
57+
;
58+
; What node modules to allow
59+
;
60+
importmap.json = importmap.json
61+
62+
;
63+
; Application Files
64+
;
65+
src/index.html = index.html
66+
src/index.js = index.js
67+
src/vm.js = vm.js
68+
src/preview.js = preview.js
69+
src/worker.js = worker.js
70+
src/git-data.js = git-data.js
71+
src/settings.json = settings.json
72+
73+
src/components = components
74+
src/views = views
75+
src/fonts = fonts
76+
src/lib = lib
77+
src/pages = pages
78+
src/css = css
79+
80+
;
81+
; Node modules
82+
;
83+
node_modules/@socketsupply/components = node_modules/@socketsupply/components
84+
node_modules/@socketsupply/indexed = node_modules/@socketsupply/indexed
85+
node_modules/@socketsupply/tonic = node_modules/@socketsupply/tonic
86+
87+
5688
[build.script]
5789
; If true, it will pass build arguments to the build script. WARNING: this could be deprecated in the future.
5890
; default value: false
@@ -64,8 +96,9 @@ forward_arguments = false
6496
; Could be a string or an array of strings
6597
sources[] = "src"
6698

67-
6899
[webview]
100+
importmap = "/importmap.json"
101+
69102
; Make root open index.html
70103
; default value: "/"
71104
root = "/"
@@ -79,7 +112,6 @@ root = "/"
79112
watch = true
80113

81114
; Custom headers injected on all webview routes
82-
[webview]
83115
; default value: ""
84116
; headers[] = "X-Custom-Header: Some-Value"
85117

@@ -99,6 +131,8 @@ $HOST_HOME = /user/home
99131
allowed[] = "https://*.stripe.com/*"
100132
allowed[] = "https://stripe.com/*"
101133
allowed[] = "https://*.stripe.network/*"
134+
allowed[] = "https://*.stripecdn.com/*"
135+
allowed[] = "https://newassets.hcaptcha.com/*"
102136

103137
[permissions]
104138
; Allow/Disallow fullscreen in application

src/components/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import fs from 'socket:fs'
22
import path from 'socket:path'
33
import { sha256 } from 'socket:network'
44

5-
import * as monaco from 'monaco-editor'
65
import Tonic from '@socketsupply/tonic'
6+
import { monaco } from '../vendor.js'
77

88
function rgbaToHex (rgbaString) {
99
const rgbaValues = rgbaString.match(/\d+/g)

src/components/git-status.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import Tonic from '@socketsupply/tonic'
21
import { exec } from 'socket:child_process'
32

3+
import Tonic from '@socketsupply/tonic'
4+
45
class GitStatus extends Tonic {
56
async * render () {
67
yield this.html`

src/components/patch-requests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import Tonic from '@socketsupply/tonic'
21
import path from 'socket:path'
32
import fs from 'socket:fs'
43
import { exec } from 'socket:child_process'
54

5+
import Tonic from '@socketsupply/tonic'
6+
67
class PatchRequests extends Tonic {
78
async click (e) {
89
const el = Tonic.match(e.target, '[data-event]')

src/components/properties.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import Tonic from '@socketsupply/tonic'
21
import process from 'socket:process'
32

3+
import Tonic from '@socketsupply/tonic'
4+
45
import Config from '../lib/config.js'
56

67
class AppProperties extends Tonic {

src/components/terminal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Tonic from '@socketsupply/tonic'
2-
import { Terminal } from 'xterm'
3-
import { FitAddon as Resizer } from 'xterm-addon-fit'
4-
import { SearchAddon as Search } from 'xterm-addon-search'
2+
import { Terminal } from '../vendor.js'
3+
import { Resizer } from '../vendor.js'
4+
import { Search } from '../vendor.js'
55

66
// const SECOND = 1000
77
// const MAX_ROWS = 30 * SECOND

src/css/page-account.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ body {
1010
display: flex;
1111
justify-content: center;
1212
align-content: center;
13-
height: 100vh;
14-
width: 100vw;
13+
overflow: hidden;
1514
}
1615

1716
form {
@@ -30,8 +29,10 @@ form {
3029

3130
#card-element {
3231
padding: 10px;
33-
border: 1px solid #ccc;
34-
border-radius: 5px;
32+
border: 1px solid var(--tonic-border);
33+
border-radius: 4px;
34+
width: 100%;
35+
height: 42px;
3536
}
3637

3738
.StripeElement {

0 commit comments

Comments
 (0)