GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dsh-browser-plugin/build.mjs at main · dataelement/dsh-browser-plugin

Expand file tree

/

build.mjs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
83 lines (82 loc) · 2.98 KB
/

build.mjs

Copy path

File metadata and controls

83 lines (82 loc) · 2.98 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { build } from 'esbuild'
import { mkdir, writeFile, readFile, readdir, rm } from 'node:fs/promises'
import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const root = new URL('./', import.meta.url)
await mkdir(new URL('lib/', root), { recursive: true })
// The Desktop generation checker resolves every runtime dependency root. Some
// Puppeteer transitives intentionally have only subpath exports or use a Node
// builtin name. Bundle that private graph so installation has no phantom peers.
// CJS also gives Puppeteer's optional Node requires their real runtime loader.
const host = await build({
entryPoints: [fileURLToPath(new URL('src/host.mjs', root))],
bundle: true,
write: false,
metafile: true,
platform: 'node',
format: 'cjs',
target: 'node22',
define: { 'import.meta.url': '__bundle_url__' },
banner: {
js: "const __bundle_url__ = require('node:url').pathToFileURL(__filename).href;",
},
legalComments: 'inline',
})
await writeFile(new URL('lib/index.cjs', root), host.outputFiles[0].text)
await rm(new URL('lib/index.js', root), { force: true })
// Preserve the license and notice of every package contributing bundled code.
const owners = new Set()
const inputDirectories = new Set(
Object.keys(host.metafile.inputs)
.filter((input) => /node_modules[\\/]/.test(input))
.map((input) => dirname(resolve(input))),
)
for (let directory of inputDirectories) {
while (directory !== dirname(directory)) {
try {
const manifest = JSON.parse(
await readFile(join(directory, 'package.json'), 'utf8'),
)
// ESM/CJS subdirectories can contain a type-only package.json. Their
// license belongs to the named package above that module boundary.
if (manifest.name && manifest.version) {
owners.add(directory)
break
}
} catch (error) {
if (error.code !== 'ENOENT') throw error
}
directory = dirname(directory)
}
}
const notices = []
for (const owner of [...owners].sort()) {
const pkg = JSON.parse(await readFile(join(owner, 'package.json'), 'utf8'))
notices.push(
`\n===== ${pkg.name}@${pkg.version} (${pkg.license || 'see notice'}) =====\n`,
)
for (const file of (await readdir(owner))
.filter((name) => /^(licen[cs]e|notice|copying)([._-]|$)/i.test(name))
.sort()) {
notices.push(`${file}\n${await readFile(join(owner, file), 'utf8')}\n`)
}
}
await writeFile(
new URL('lib/THIRD_PARTY_LICENSES.txt', root),
notices.join('\n'),
)
const result = await build({
entryPoints: [fileURLToPath(new URL('src/client.jsx', root))],
bundle: true,
write: false,
platform: 'browser',
format: 'cjs',
target: 'es2022',
external: ['react', 'react-dom'],
loader: { '.css': 'text' },
legalComments: 'inline',
})
await writeFile(
new URL('lib/client.js', root),
`window.__ModuleLoader__.load({id:'dsh-page-review',factory:(require)=>{const module={exports:{}};const exports=module.exports;\n${result.outputFiles[0].text}\nreturn module.exports;}});\n`,
)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.