@proveanything/smartlinks 2.1.10 → 2.1.12

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,87 +1,87 @@
1
- {
2
- "name": "@proveanything/smartlinks",
3
- "version": "2.1.10",
4
- "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "default": "./dist/index.js"
13
- },
14
- "./testing": {
15
- "types": "./dist/testing/index.d.ts",
16
- "import": "./dist/testing/index.js",
17
- "default": "./dist/testing/index.js"
18
- },
19
- "./*": {
20
- "types": "./dist/*.d.ts",
21
- "import": "./dist/*.js",
22
- "default": "./dist/*.js"
23
- },
24
- "./baseline.css": "./dist/baseline.css",
25
- "./baseline.classes.json": "./dist/baseline.classes.json",
26
- "./theme.css": "./dist/theme.css",
27
- "./theme-boot.js": "./dist/theme-boot.js",
28
- "./package.json": "./package.json"
29
- },
30
- "bin": {
31
- "smartlinks-register-release": "scripts/register-release.mjs",
32
- "smartlinks-publish": "scripts/publish.mjs",
33
- "smartlinks-doctor": "scripts/doctor.mjs",
34
- "smartlinks-headless": "scripts/headless-check.mjs"
35
- },
36
- "files": [
37
- "dist/",
38
- "docs/",
39
- "scripts/register-release.mjs",
40
- "scripts/publish.mjs",
41
- "scripts/doctor.mjs",
42
- "scripts/headless-check.mjs",
43
- "scripts/lib/",
44
- "openapi.yaml",
45
- "README.md"
46
- ],
47
- "scripts": {
48
- "test": "node test/run.cjs",
49
- "build": "tsc && node scripts/fix-esm-extensions.mjs && node generate-api-summary.cjs && node generate-openapi.cjs && node scripts/copy-docs-to-dist.cjs && node scripts/build-baseline.mjs",
50
- "docs": "typedoc",
51
- "docs:summary": "node generate-api-summary.cjs",
52
- "docs:openapi": "node generate-openapi.cjs",
53
- "docs:openapi:lint": "npx --yes @redocly/cli@latest lint openapi.yaml",
54
- "docs:openapi:check": "node generate-openapi.cjs && npx --yes @redocly/cli@latest lint openapi.yaml",
55
- "build:docs": "tsc build-docs.ts --outDir dist && node dist/build-docs.js",
56
- "prepublishOnly": "npm run build"
57
- },
58
- "keywords": [
59
- "smartlinks",
60
- "api",
61
- "authentication",
62
- "traceability",
63
- "blockchain",
64
- "typescript",
65
- "sdk"
66
- ],
67
- "author": "Glenn Shoosmith",
68
- "license": "MIT",
69
- "publishConfig": {
70
- "access": "public"
71
- },
72
- "dependencies": {
73
- "cross-fetch": "^3.1.5",
74
- "es-module-lexer": "^1.7.0"
75
- },
76
- "devDependencies": {
77
- "ts-node": "^10.9.1",
78
- "typedoc": "^0.25.13",
79
- "typedoc-plugin-markdown": "^3.17.1",
80
- "typescript": "^4.9.0"
81
- },
82
- "repository": {
83
- "type": "git",
84
- "url": "https://github.com/Prove-Anything/smartlinks.git"
85
- },
86
- "homepage": "https://smartlinks.app"
87
- }
1
+ {
2
+ "name": "@proveanything/smartlinks",
3
+ "version": "2.1.12",
4
+ "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./testing": {
15
+ "types": "./dist/testing/index.d.ts",
16
+ "import": "./dist/testing/index.js",
17
+ "default": "./dist/testing/index.js"
18
+ },
19
+ "./*": {
20
+ "types": "./dist/*.d.ts",
21
+ "import": "./dist/*.js",
22
+ "default": "./dist/*.js"
23
+ },
24
+ "./baseline.css": "./dist/baseline.css",
25
+ "./baseline.classes.json": "./dist/baseline.classes.json",
26
+ "./theme.css": "./dist/theme.css",
27
+ "./theme-boot.js": "./dist/theme-boot.js",
28
+ "./package.json": "./package.json"
29
+ },
30
+ "bin": {
31
+ "smartlinks-register-release": "scripts/register-release.mjs",
32
+ "smartlinks-publish": "scripts/publish.mjs",
33
+ "smartlinks-doctor": "scripts/doctor.mjs",
34
+ "smartlinks-headless": "scripts/headless-check.mjs"
35
+ },
36
+ "files": [
37
+ "dist/",
38
+ "docs/",
39
+ "scripts/register-release.mjs",
40
+ "scripts/publish.mjs",
41
+ "scripts/doctor.mjs",
42
+ "scripts/headless-check.mjs",
43
+ "scripts/lib/",
44
+ "openapi.yaml",
45
+ "README.md"
46
+ ],
47
+ "scripts": {
48
+ "test": "node test/run.cjs",
49
+ "build": "tsc && node scripts/fix-esm-extensions.mjs && node generate-api-summary.cjs && node generate-openapi.cjs && node scripts/copy-docs-to-dist.cjs && node scripts/build-baseline.mjs",
50
+ "docs": "typedoc",
51
+ "docs:summary": "node generate-api-summary.cjs",
52
+ "docs:openapi": "node generate-openapi.cjs",
53
+ "docs:openapi:lint": "npx --yes @redocly/cli@latest lint openapi.yaml",
54
+ "docs:openapi:check": "node generate-openapi.cjs && npx --yes @redocly/cli@latest lint openapi.yaml",
55
+ "build:docs": "tsc build-docs.ts --outDir dist && node dist/build-docs.js",
56
+ "prepublishOnly": "npm run build"
57
+ },
58
+ "keywords": [
59
+ "smartlinks",
60
+ "api",
61
+ "authentication",
62
+ "traceability",
63
+ "blockchain",
64
+ "typescript",
65
+ "sdk"
66
+ ],
67
+ "author": "Glenn Shoosmith",
68
+ "license": "MIT",
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "dependencies": {
73
+ "cross-fetch": "^3.1.5",
74
+ "es-module-lexer": "^1.7.0"
75
+ },
76
+ "devDependencies": {
77
+ "ts-node": "^10.9.1",
78
+ "typedoc": "^0.25.13",
79
+ "typedoc-plugin-markdown": "^3.17.1",
80
+ "typescript": "^4.9.0"
81
+ },
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "https://github.com/Prove-Anything/smartlinks.git"
85
+ },
86
+ "homepage": "https://smartlinks.app"
87
+ }
@@ -30,19 +30,29 @@ const CHANNEL = flag('--channel', process.env.SMARTLINKS_CHANNEL || 'dev')
30
30
  const DIR = flag('--dir', 'dist')
31
31
  const WATCH = args.includes('--watch')
32
32
 
33
- // Mirror of the server's write allowlist — a bundle is static web assets only. Source maps (.map) are
34
- // never published: a release is promoted to beta and stable as-is, so a map would serve the app's
35
- // original source publicly (and maps are most of a bundle's size). Debug in Forge's preview; a
36
- // Release to dev is a readable, unminified build instead.
37
- const ALLOWED = new Set(['.js', '.mjs', '.css', '.json', '.wasm', '.html', '.txt',
38
- '.svg', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif', '.ico', '.woff', '.woff2', '.ttf', '.otf'])
33
+ // Every built file is published except two kinds. Source maps (.map): a release is promoted to beta and
34
+ // stable as-is, so a map would serve the app's original source publicly (and maps are most of a bundle's
35
+ // size); debug in Forge's preview, and a Release to dev is a readable, unminified build instead. And the
36
+ // server's block list (prove services/apps/appBucket.js — keep in step): programs and installers, server
37
+ // config, keys. SmartLinks serves web types as themselves and anything else as a download.
38
+ const BLOCKED_EXT = new Set(['.exe', '.msi', '.msix', '.dll', '.com', '.scr', '.bat', '.cmd', '.ps1', '.psm1', '.vbs', '.vbe',
39
+ '.wsf', '.hta', '.lnk', '.reg', '.cpl', '.jar', '.apk', '.aab', '.ipa', '.dmg', '.pkg', '.deb', '.rpm', '.appimage', '.sh',
40
+ '.bash', '.php', '.phtml', '.asp', '.aspx', '.jsp', '.cgi', '.pl', '.py', '.pem', '.key', '.p12', '.pfx', '.jks', '.keystore'])
41
+ const BLOCKED_NAMES = new Set(['_headers', '_redirects', '.htaccess', '.htpasswd', 'web.config', '.npmrc', '.yarnrc', '.ds_store'])
39
42
  const extOf = (p) => { const i = p.lastIndexOf('.'); return i < 0 ? '' : p.slice(i).toLowerCase() }
43
+ const isBlocked = (rel) => {
44
+ const base = rel.slice(rel.lastIndexOf('/') + 1).toLowerCase()
45
+ if (BLOCKED_NAMES.has(base) || BLOCKED_EXT.has(extOf(base))) return true
46
+ return /^\.env(\.|$)/.test(base) || rel.toLowerCase().split('/').some((seg) => seg === '.git' || seg === '.ssh')
47
+ }
40
48
 
41
49
  function fail(msg) { console.error(`❌ ${msg}`); process.exit(1) }
42
50
  if (!APP_ID) fail('SMARTLINKS_APP_ID is required')
43
51
  if (!KEY) fail('SMARTLINKS_DEPLOY_KEY is required')
44
52
 
45
53
  let skippedMaps = 0
54
+ /** Built files SmartLinks never serves (the block list) — said out loud: an app that loads one would 404. */
55
+ let skippedOther = []
46
56
 
47
57
  function collectFiles(dir) {
48
58
  const out = {}
@@ -50,8 +60,9 @@ function collectFiles(dir) {
50
60
  for (const e of readdirSync(d, { withFileTypes: true })) {
51
61
  const full = join(d, e.name)
52
62
  if (e.isDirectory()) { walk(full); continue }
53
- if (!ALLOWED.has(extOf(e.name))) { if (extOf(e.name) === '.map') skippedMaps++; continue }
54
63
  const rel = relative(dir, full).split(sep).join('/') // forward slashes for the bucket
64
+ if (extOf(e.name) === '.map') { skippedMaps++; continue }
65
+ if (isBlocked(rel)) { skippedOther.push(rel); continue }
55
66
  out[rel] = readFileSync(full)
56
67
  }
57
68
  }
@@ -173,9 +184,13 @@ async function publishOnce() {
173
184
  if (!stat.isDirectory()) fail(`${DIR} is not a directory`)
174
185
 
175
186
  skippedMaps = 0
187
+ skippedOther = []
176
188
  const files = collectFiles(DIR)
177
189
  if (!files['app.manifest.json']) fail(`${DIR}/app.manifest.json not found — is this a built app bundle?`)
178
190
  if (skippedMaps) console.log(` (${skippedMaps} source map${skippedMaps === 1 ? '' : 's'} left out — maps are never published)`)
191
+ if (skippedOther.length) {
192
+ console.warn(`⚠️ ${skippedOther.length} file${skippedOther.length === 1 ? '' : 's'} left out — SmartLinks never serves programs, server config or keys, so the app can't load ${skippedOther.length === 1 ? 'it' : 'them'}: ${skippedOther.slice(0, 8).join(', ')}${skippedOther.length > 8 ? ', …' : ''}`)
193
+ }
179
194
 
180
195
  const t0 = Date.now()
181
196
  const entries = Object.entries(files)