@melt-js/libs-core 2026.11.16-1 → 2026.11.16-2
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/README.md +38 -22
- package/dist/browser.d.mts +3 -3
- package/dist/browser.mjs +1 -1
- package/dist/browser.mjs.gz +0 -0
- package/dist/cdn/browser.umd.cjs +1 -1
- package/dist/cdn/browser.umd.cjs.gz +0 -0
- package/dist/cdn/demo-browser.umd.cjs +1 -1
- package/dist/cdn/demo-browser.umd.cjs.gz +0 -0
- package/dist/cdn/demo.umd.cjs +1 -1
- package/dist/cdn/demo.umd.cjs.gz +0 -0
- package/dist/cdn/example-esm.html +1 -1
- package/dist/cdn/index.umd.cjs +1 -1
- package/dist/cdn/index.umd.cjs.gz +0 -0
- package/dist/cdn/manifest.json +17 -5
- package/dist/cdn/vendor.umd.cjs +0 -34
- package/dist/cdn/vendor.umd.cjs.gz +0 -0
- package/dist/cdn.d.mts +3 -3
- package/dist/cdn.mjs +1 -1
- package/dist/demo/browser.d.mts +1 -0
- package/dist/demo/browser.mjs +1 -1
- package/dist/demo/browser.mjs.gz +0 -0
- package/dist/demo/clipboard.d.mts +6 -6
- package/dist/demo/clipboard.mjs +1 -1
- package/dist/demo/docs.d.mts +28 -28
- package/dist/demo/docs.mjs +1 -1
- package/dist/demo/docs.mjs.gz +0 -0
- package/dist/demo/download.d.mts +3 -0
- package/dist/demo/download.mjs +1 -1
- package/dist/demo/download.mjs.gz +0 -0
- package/dist/demo/fullscreen.d.mts +8 -8
- package/dist/demo/fullscreen.mjs +1 -1
- package/dist/demo/highlight.d.mts +2 -0
- package/dist/demo/highlight.mjs +1 -0
- package/dist/demo/index.d.mts +1 -0
- package/dist/demo/index.mjs +1 -1
- package/dist/demo/model.d.mts +12 -12
- package/dist/demo/remote-debug.d.mts +9 -11
- package/dist/demo/remote-debug.mjs +1 -1
- package/dist/demo/split-pane.d.mts +8 -8
- package/dist/demo/split-pane.mjs +1 -1
- package/dist/demo/standalone.d.mts +3 -0
- package/dist/demo/standalone.mjs +1 -1
- package/dist/demo/standalone.mjs.gz +0 -0
- package/dist/demo/tabs.d.mts +15 -15
- package/dist/demo/tabs.mjs +1 -1
- package/dist/loading.mjs +1 -1
- package/dist/loading.mjs.gz +0 -0
- package/dist/remote.d.mts +114 -110
- package/dist/remote.mjs +1 -1
- package/dist/remote.mjs.gz +0 -0
- package/dist/vendor/hel-runtime.mjs +0 -34
- package/dist/vendor/hel-runtime.mjs.gz +0 -0
- package/package.json +1 -1
- package/scripts/browser-formats.mjs +8 -6
- package/scripts/build-browser.mjs +2 -2
- package/scripts/build-protected-esm.mjs +54 -51
- package/scripts/cdn-runtime.cjs +30 -30
- package/scripts/client-build-security.cjs +48 -48
- package/scripts/component-events.mjs +57 -57
- package/scripts/comps-bundle-obfuscation.cjs +4 -1
- package/scripts/comps-obfuscator-options.cjs +7 -1
- package/scripts/obfuscator-split-strings.cjs +22 -0
- package/scripts/package-artifacts.mjs +3 -3
- package/scripts/package-env.cjs +46 -90
- package/scripts/remote-address.cjs +30 -30
- package/scripts/vdoc-parser/NOTICE.md +13 -13
- package/scripts/vdoc-parser/constants.mjs +3 -3
- package/scripts/vdoc-parser/index.d.mts +34 -34
- package/scripts/vdoc-parser/index.mjs +2 -2
- package/scripts/vdoc-parser/parsers/index.mjs +14 -14
- package/scripts/vdoc-parser/parsers/parseCode.mjs +42 -42
- package/scripts/vdoc-parser/parsers/parseCommentBlock.mjs +9 -9
- package/scripts/vdoc-parser/parsers/parseComponentOptions.mjs +12 -12
- package/scripts/vdoc-parser/parsers/parseDefaultValue.mjs +57 -57
- package/scripts/vdoc-parser/parsers/parseDefineProps.mjs +33 -33
- package/scripts/vdoc-parser/parsers/parseExport.mjs +93 -93
- package/scripts/vdoc-parser/parsers/parseFile.mjs +22 -22
- package/scripts/vdoc-parser/parsers/parseFileSync.mjs +22 -22
- package/scripts/vdoc-parser/parsers/parsePropType.mjs +32 -32
- package/scripts/vdoc-parser/parsers/parseProps.mjs +90 -90
- package/scripts/vdoc-parser/parsers/parseSetupScript.mjs +14 -14
- package/scripts/vdoc-parser/parsers/parseSfc.mjs +21 -21
- package/scripts/vdoc-parser/parsers/parseTSTypeLiteral.mjs +48 -48
- package/scripts/vdoc-parser/parsers/parseTypes.mjs +53 -53
- package/scripts/vdoc-parser/parsers/parseTypesFile.mjs +22 -22
- package/scripts/vdoc-parser/parsers/parseTypesFileSync.mjs +22 -22
- package/scripts/vdoc-parser/resolvers/index.mjs +2 -2
- package/scripts/vdoc-parser/resolvers/resolveSpreadElements.mjs +51 -51
- package/scripts/vdoc-parser/utils.mjs +52 -52
- package/scripts/webpack-bundle-obfuscation.cjs +3 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require('node:fs')
|
|
2
|
+
const path = require('node:path')
|
|
3
|
+
|
|
4
|
+
// `splitStringsChunkLength` granularity, resolved per package family.
|
|
5
|
+
// libs packages publish shared ESM/UMD straight to hosts, so a coarse 10-character split keeps
|
|
6
|
+
// the public bundle close to the unsplit size; comps/demo/tpl keep the finer 5-character split.
|
|
7
|
+
const LIBS_CHUNK_LENGTH = 10
|
|
8
|
+
const DEFAULT_CHUNK_LENGTH = 5
|
|
9
|
+
|
|
10
|
+
function packageNameOf(root) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(fs.readFileSync(path.join(path.resolve(root), 'package.json'), 'utf8')).name || ''
|
|
13
|
+
} catch {
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function splitStringsChunkLength(root) {
|
|
19
|
+
return /^@melt-js\/libs-/.test(packageNameOf(root)) ? LIBS_CHUNK_LENGTH : DEFAULT_CHUNK_LENGTH
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { splitStringsChunkLength, packageNameOf }
|
|
@@ -148,7 +148,7 @@ export async function buildPackageArtifacts(root = process.cwd()) {
|
|
|
148
148
|
const finalObfuscator = pluginModule.default.default || pluginModule.default
|
|
149
149
|
plugins.push(...bundleObfuscation.bundleObfuscationPlugins({ root, obfuscatorPlugin: finalObfuscator,
|
|
150
150
|
enabled: process.env.HEL_OBFUSCATE !== '0', library: true, rolldown: config.rolldown === true }), bundleObfuscation.gzipPlugin())
|
|
151
|
-
await viteBuild({ configFile: false, root, plugins, css: { postcss: { plugins: [] } },
|
|
151
|
+
await viteBuild({ configFile: false, root, plugins, esbuild: { legalComments: 'none' }, css: { postcss: { plugins: [] } },
|
|
152
152
|
build: { outDir: out, emptyOutDir: false, minify: true, sourcemap: false, target: 'es2020',
|
|
153
153
|
lib: { entry: Object.fromEntries(Object.entries(entries).map(([key, value]) => [key, path.join(root, value)])), formats: ['es'], fileName: (_format, name) => name + '.js' },
|
|
154
154
|
rollupOptions: { external: id => id !== pkg.name && !id.startsWith(pkg.name + '/') && !id.startsWith('.') && !path.isAbsolute(id) && !id.startsWith('\0') },
|
|
@@ -169,11 +169,11 @@ export async function buildPackageArtifacts(root = process.cwd()) {
|
|
|
169
169
|
await buildProtectedEsm({ absWorkingDir: root, entryPoints: entries, outdir: out, bundle: true, packages: 'external', define: { 'import.meta.env.DEV': 'false', 'import.meta.env.PROD': 'true' }, format: 'esm', platform: 'neutral', target: 'es2022', minify: true }, { root })
|
|
170
170
|
}
|
|
171
171
|
if (config.bin) {
|
|
172
|
-
await build({ absWorkingDir: root, entryPoints: [config.bin], outfile: path.join(out, 'cli.mjs'), bundle: true, packages: 'external', platform: 'node', format: 'esm', target: 'node22', minify: true, banner: { js: '#!/usr/bin/env node' } })
|
|
172
|
+
await build({ absWorkingDir: root, entryPoints: [config.bin], outfile: path.join(out, 'cli.mjs'), bundle: true, packages: 'external', platform: 'node', format: 'esm', target: 'node22', minify: true, legalComments: 'none', banner: { js: '#!/usr/bin/env node' } })
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (config.resolver) {
|
|
176
|
-
await build({ absWorkingDir: root, entryPoints: [config.resolver], outfile: path.join(out, 'resolver.js'), bundle: true, packages: 'external', platform: 'node', format: 'esm', minify: true,
|
|
176
|
+
await build({ absWorkingDir: root, entryPoints: [config.resolver], outfile: path.join(out, 'resolver.js'), bundle: true, packages: 'external', platform: 'node', format: 'esm', minify: true, legalComments: 'none',
|
|
177
177
|
plugins: [{ name: 'package-name', setup(builder) { builder.onLoad({ filter: /resolver\.ts$/ }, args => ({ loader: 'ts', contents: fs.readFileSync(args.path, 'utf8').replace("createRequire(import.meta.url)('./package.json').name", JSON.stringify(pkg.name)) })) } }],
|
|
178
178
|
})
|
|
179
179
|
const program = ts.createProgram([path.join(root, config.resolver)], { ...compilerOptions, rootDir: root, outDir: path.join(typeOut, '__tools') })
|
package/scripts/package-env.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const fs = require('node:fs')
|
|
2
2
|
const path = require('node:path')
|
|
3
|
-
const { createRequire } = require('node:module')
|
|
4
3
|
const dotenv = require('dotenv')
|
|
5
4
|
const { expand } = require('dotenv-expand')
|
|
6
5
|
const { packageRef, packageUrl } = require('./remote-address.cjs')
|
|
@@ -8,7 +7,6 @@ const { packageRef, packageUrl } = require('./remote-address.cjs')
|
|
|
8
7
|
const PUBLIC_ENV_KEYS = ['SFTP_PUBLIC_URL', 'GITHUB_PUBLIC_URL', 'UNPKG_PUBLIC_URL']
|
|
9
8
|
const WORKSPACE_ENV_KEYS = [...PUBLIC_ENV_KEYS, 'HEL_RELATIVE_PATH']
|
|
10
9
|
const TARGETS = ['local', 'sftp', 'github', 'unpkg']
|
|
11
|
-
const trim = value => String(value || '').trim().replace(/\/+$/, '')
|
|
12
10
|
|
|
13
11
|
function readEnvFile(file) {
|
|
14
12
|
return fs.existsSync(file) ? dotenv.parse(fs.readFileSync(file)) : {}
|
|
@@ -16,73 +14,35 @@ function readEnvFile(file) {
|
|
|
16
14
|
|
|
17
15
|
function readPackageFiles(cwd, mode) {
|
|
18
16
|
// The root orchestrator copies only public bases here. Never read a parent directory.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
].map(name => readEnvFile(path.join(cwd, name))))
|
|
17
|
+
const names = ['.env.defaults', '.env.workspace.local', '.env', `.env.${mode}`, '.env.local', `.env.${mode}.local`]
|
|
18
|
+
return Object.assign({}, ...names.filter(Boolean).map(name => readEnvFile(path.join(cwd, name))))
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
// Validate/stamp the actual keys declared in env files; never derive other keys or URLs.
|
|
22
|
+
function remoteEntries(env) {
|
|
23
|
+
return Object.entries(env).filter(([key, value]) =>
|
|
24
|
+
/^(?:VITE_|VUE_APP_|REACT_APP_|HEL_).+_(?:HOST|ENTRY)$/.test(key) && typeof value === 'string' && value !== '')
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
function resolveTarget(value, mode) {
|
|
30
28
|
const target = String(value || 'auto').toLowerCase()
|
|
31
|
-
if (target === 'auto') return ['development', 'mock'].includes(mode) ? 'local' : '
|
|
29
|
+
if (target === 'auto') return ['development', 'mock'].includes(mode) ? 'local' : 'sftp'
|
|
32
30
|
if (!TARGETS.includes(target)) throw new Error(`[hel-env] Unknown remote target: ${target}`)
|
|
33
31
|
return target
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (fs.existsSync(manifest)) {
|
|
48
|
-
const pkg = JSON.parse(fs.readFileSync(manifest, 'utf8'))
|
|
49
|
-
if (pkg.name === packageName) return pkg.version
|
|
34
|
+
function validateRemoteEntries(env) {
|
|
35
|
+
for (const [key, value] of remoteEntries(env)) {
|
|
36
|
+
if (value.startsWith('./') || value.startsWith('/')) {
|
|
37
|
+
if (env.HEL_DEPLOY_TARGET) throw new Error('[hel-env] ' + key + ': deployment requires an absolute HTTP(S) entry')
|
|
38
|
+
continue
|
|
39
|
+
}
|
|
40
|
+
let url
|
|
41
|
+
try { url = new URL(value) } catch { throw new Error('[hel-env] ' + key + ': configure a complete HTTP(S) entry in the package env file') }
|
|
42
|
+
if (!/^https?:$/.test(url.protocol)) throw new Error('[hel-env] ' + key + ': entry must use HTTP(S)')
|
|
43
|
+
if (env.HEL_DEPLOY_TARGET && /^(?:localhost|127\.0\.0\.1|\[::1\])$/.test(url.hostname)) {
|
|
44
|
+
throw new Error('[hel-env] ' + key + ': deployment entry cannot point to localhost')
|
|
50
45
|
}
|
|
51
|
-
const parent = path.dirname(directory)
|
|
52
|
-
if (parent === directory) throw new Error(`[hel-env] Cannot resolve installed version of ${packageName}; set the dependency's VERSION explicitly`)
|
|
53
|
-
directory = parent
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function resolveRemoteUrl(env, slot, target) {
|
|
58
|
-
const packageName = env[`${slot}_PACKAGE`]
|
|
59
|
-
if (target === 'local') {
|
|
60
|
-
const url = trim(env[`${slot}_LOCAL_URL`])
|
|
61
|
-
if (!url) throw new Error(`[hel-env] ${slot}_LOCAL_URL is required for local development`)
|
|
62
|
-
return url
|
|
63
|
-
}
|
|
64
|
-
const base = trim(env[`${target.toUpperCase()}_PUBLIC_URL`])
|
|
65
|
-
let version = env[`DEPLOY_${slot}_VERSION`] || env[`${slot}_VERSION`] || 'latest'
|
|
66
|
-
if (target === 'unpkg' && version === 'installed') version = installedVersion(env.HEL_ENV_PACKAGE || process.cwd(), packageName)
|
|
67
|
-
const output = env[`${slot}_OUTPUT_DIR`] || 'hel_dist'
|
|
68
|
-
const entry = env[`${slot}_ENTRY`] || 'hel-meta.json'
|
|
69
|
-
try {
|
|
70
|
-
const parsed = packageRef(packageName)
|
|
71
|
-
parsed.version = version
|
|
72
|
-
const url = packageUrl(parsed, {
|
|
73
|
-
type: target === 'sftp' ? 'custom' : target, base,
|
|
74
|
-
projectName: target === 'unpkg' ? undefined : env[`${slot}_PROJECT`],
|
|
75
|
-
// Static deployments update project directories; unpkg versions are npm versions.
|
|
76
|
-
versioned: target === 'unpkg',
|
|
77
|
-
})
|
|
78
|
-
url.pathname += '/' + output + '/' + entry
|
|
79
|
-
return url.href
|
|
80
|
-
} catch (error) { throw new Error(`[hel-env] ${slot}: ${error.message}`) }
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function assertSameOrigin(url, base, slot) {
|
|
84
|
-
if (new URL(url).origin !== new URL(base).origin) {
|
|
85
|
-
throw new Error(`[hel-env] ${slot} must use the deployment origin ${new URL(base).origin}: ${url}`)
|
|
86
46
|
}
|
|
87
47
|
}
|
|
88
48
|
|
|
@@ -103,8 +63,30 @@ function loadPackageEnv({ cwd = process.cwd(), mode = 'development', env = proce
|
|
|
103
63
|
delete inherited.HEL_ENV_GENERATED
|
|
104
64
|
delete inherited.HEL_ENV_DERIVED_KEYS
|
|
105
65
|
delete inherited.HEL_ENV_PACKAGE
|
|
106
|
-
const
|
|
66
|
+
const defaults = { ...readPackageFiles(cwd, mode), ...inherited }
|
|
67
|
+
const runtimeMode = defaults.NODE_ENV || mode
|
|
68
|
+
const deployTarget = defaults.HEL_DEPLOY_TARGET
|
|
69
|
+
const requestedTarget = deployTarget || target || defaults.REMOTE_TARGET
|
|
70
|
+
const selected = resolveTarget(requestedTarget, runtimeMode)
|
|
71
|
+
localBuild ||= defaults.HEL_LOCAL_BUILD === '1'
|
|
72
|
+
const values = { UNPKG_PUBLIC_URL: 'https://unpkg.com', ...defaults }
|
|
107
73
|
values.HEL_ENV_PACKAGE = path.resolve(cwd)
|
|
74
|
+
// Manifest mappings spell out both the consumer key and each candidate key.
|
|
75
|
+
// No suffix convention is used to invent configuration keys or URL paths.
|
|
76
|
+
const manifest = path.join(cwd, 'package.json')
|
|
77
|
+
const entryMap = fs.existsSync(manifest) ? JSON.parse(fs.readFileSync(manifest, 'utf8')).config?.remoteEntries || {} : {}
|
|
78
|
+
const overrides = { ...readEnvFile(path.join(cwd, '.env.local')), ...readEnvFile(path.join(cwd, `.env.${mode}.local`)), ...inherited }
|
|
79
|
+
for (const [entryKey, candidates] of Object.entries(entryMap)) {
|
|
80
|
+
if (Object.hasOwn(overrides, entryKey)) continue
|
|
81
|
+
const candidateKey = candidates[selected]
|
|
82
|
+
if (!candidateKey || !values[candidateKey]?.trim()) {
|
|
83
|
+
throw new Error(`[hel-env] ${entryKey}: no explicit ${selected} entry declared in package.json config.remoteEntries and .env`)
|
|
84
|
+
}
|
|
85
|
+
for (const match of values[candidateKey].matchAll(/\$\{([A-Z][A-Z0-9_]*)\}/g)) {
|
|
86
|
+
if (!values[match[1]]) throw new Error(`[hel-env] ${entryKey}: configure ${match[1]} in .env.local or sync the shared workspace roots`)
|
|
87
|
+
}
|
|
88
|
+
values[entryKey] = values[candidateKey]
|
|
89
|
+
}
|
|
108
90
|
expand({ parsed: values, processEnv: { ...values } })
|
|
109
91
|
values.UNPKG_PUBLIC_URL ||= 'https://unpkg.com'
|
|
110
92
|
const derived = new Set()
|
|
@@ -112,10 +94,6 @@ function loadPackageEnv({ cwd = process.cwd(), mode = 'development', env = proce
|
|
|
112
94
|
if (!value) return
|
|
113
95
|
if (!values[key]) { values[key] = String(value); derived.add(key) }
|
|
114
96
|
}
|
|
115
|
-
const deployTarget = values.HEL_DEPLOY_TARGET
|
|
116
|
-
const runtimeMode = values.NODE_ENV || mode
|
|
117
|
-
const selected = resolveTarget(deployTarget || target || values.REMOTE_TARGET, runtimeMode)
|
|
118
|
-
localBuild ||= values.HEL_LOCAL_BUILD === '1'
|
|
119
97
|
const port = inherited.PORT || inherited.DEV_PORT || inherited.VITE_PORT || values.PORT || values.DEV_PORT
|
|
120
98
|
const previewPort = values.PREVIEW_PORT || port
|
|
121
99
|
if (port && (!/^\d+$/.test(String(port)) || +port < 1 || +port > 65535)) throw new Error('[hel-env] DEV_PORT must be between 1 and 65535')
|
|
@@ -128,32 +106,7 @@ function loadPackageEnv({ cwd = process.cwd(), mode = 'development', env = proce
|
|
|
128
106
|
put('VUE_APP_PREVIEW_PORT', previewPort)
|
|
129
107
|
put('VITE_DEV_ORIGIN', values.DEV_ORIGIN || (port ? `http://localhost:${port}` : ''))
|
|
130
108
|
put('VUE_APP_DEV_ORIGIN', values.VITE_DEV_ORIGIN)
|
|
131
|
-
|
|
132
|
-
for (const slot of remoteSlots(values)) {
|
|
133
|
-
const slotTarget = resolveTarget(deployTarget || target || values[`${slot}_TARGET`] || selected, runtimeMode)
|
|
134
|
-
const keys = [`VITE_${slot}_HOST`, `VUE_APP_${slot}_HOST`, `REACT_APP_${slot}_HOST`, `HEL_${slot}_HOST`]
|
|
135
|
-
const overrides = [...keys, `VUE_APP_${slot}_ENTRY`, `VITE_${slot}_ENTRY`, `${slot}_URL`]
|
|
136
|
-
.map(key => values[key]).filter(Boolean)
|
|
137
|
-
if (new Set(overrides).size > 1) throw new Error(`[hel-env] Conflicting ${slot} address overrides`)
|
|
138
|
-
const explicit = overrides[0]
|
|
139
|
-
const expected = !explicit || deployTarget
|
|
140
|
-
? localBuild && !deployTarget && values[`${slot}_BUNDLED_PATH`]
|
|
141
|
-
? './' + values[`${slot}_BUNDLED_PATH`]
|
|
142
|
-
: resolveRemoteUrl(values, slot, slotTarget)
|
|
143
|
-
: explicit
|
|
144
|
-
const resolved = explicit || expected
|
|
145
|
-
if (deployTarget) {
|
|
146
|
-
assertSameOrigin(resolved, values[`${deployTarget.toUpperCase()}_PUBLIC_URL`] || expected, slot)
|
|
147
|
-
if (resolved !== expected) throw new Error(`[hel-env] ${slot} must match the deployment package/version URL: ${expected}`)
|
|
148
|
-
}
|
|
149
|
-
for (const key of keys) put(key, resolved)
|
|
150
|
-
if (values[`${slot}_ENTRY`] === 'index.html') {
|
|
151
|
-
put(`VUE_APP_${slot}_ENTRY`, resolved)
|
|
152
|
-
put(`VITE_${slot}_ENTRY`, resolved)
|
|
153
|
-
}
|
|
154
|
-
put(`VITE_${slot}_LOCAL_URL`, values[`${slot}_LOCAL_URL`])
|
|
155
|
-
put(`VUE_APP_${slot}_LOCAL_URL`, values[`${slot}_LOCAL_URL`])
|
|
156
|
-
}
|
|
109
|
+
validateRemoteEntries(values)
|
|
157
110
|
if (localBuild && values.VITE_DEV_ORIGIN) put('HEL_APP_HOME_PAGE', values.VITE_DEV_ORIGIN)
|
|
158
111
|
if (runtimeMode === 'production' && !localBuild) {
|
|
159
112
|
let defaultHomePage = values.HEL_APP_HOME_PAGE
|
|
@@ -191,10 +144,13 @@ function inferMode(env = process.env, argv = process.argv) {
|
|
|
191
144
|
|
|
192
145
|
function applyPackageEnv({ cwd = process.cwd(), mode = inferMode() } = {}) {
|
|
193
146
|
const values = loadPackageEnv({ cwd, mode })
|
|
147
|
+
for (const [key, value] of Object.entries(JSON.parse(process.env.HEL_ENV_GENERATED || '{}'))) {
|
|
148
|
+
if (process.env[key] === value && !Object.hasOwn(values, key)) delete process.env[key]
|
|
149
|
+
}
|
|
194
150
|
const preview = /^(?:preview|serve:dist)/.test(process.env.npm_lifecycle_event || '')
|
|
195
151
|
if (preview && !process.env.PORT && values.PREVIEW_PORT) values.PORT = values.PREVIEW_PORT
|
|
196
152
|
Object.assign(process.env, values)
|
|
197
153
|
return values
|
|
198
154
|
}
|
|
199
155
|
|
|
200
|
-
module.exports = { applyPackageEnv, inferMode, PUBLIC_ENV_KEYS, WORKSPACE_ENV_KEYS, readEnvFile, readPackageFiles,
|
|
156
|
+
module.exports = { applyPackageEnv, inferMode, PUBLIC_ENV_KEYS, WORKSPACE_ENV_KEYS, readEnvFile, readPackageFiles, remoteEntries, resolveTarget, resolveBuildHomePage, loadPackageEnv }
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// Shared by browser loading and Node env generation; no project-specific defaults.
|
|
2
|
-
const HEL_BASES = Object.freeze({ unpkg: 'https://unpkg.com' })
|
|
3
|
-
|
|
4
|
-
function packageRef(ref) {
|
|
5
|
-
const match = /^(?:(@[a-z\d._-]+)\/)?([a-z\d][a-z\d._-]*)(?:@([a-z\d][a-z\d.+_-]*))?$/i.exec(ref)
|
|
6
|
-
if (!match) throw new Error('无效的远程包名称或版本:' + ref)
|
|
7
|
-
const [, scope, name, version] = match
|
|
8
|
-
return { scope: scope || '', name, packageName: (scope ? scope + '/' : '') + name, version: version || '' }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** Returns the package directory; callers select the output directory and entry. */
|
|
12
|
-
function packageUrl(parsed, { type = 'unpkg', base, projectName, versioned = true } = {}) {
|
|
13
|
-
const root = base || HEL_BASES[type]
|
|
14
|
-
|| (type === 'github' && parsed.scope ? 'https://' + parsed.scope.slice(1) + '.github.io' : '')
|
|
15
|
-
if (!root) throw new Error(type === 'github' ? 'github 无 scope 的包引用需要 base(无法推导组织)' : 'custom 加载需要 base')
|
|
16
|
-
let url
|
|
17
|
-
try { url = new URL(root) } catch { throw new Error('需要绝对 HTTP(S) 地址:' + root) }
|
|
18
|
-
if (!/^https?:$/.test(url.protocol)) throw new Error('不支持的地址协议:' + root)
|
|
19
|
-
if (url.search || url.hash) throw new Error('base 不能包含查询参数或 hash:' + root)
|
|
20
|
-
const name = projectName || (type === 'github' ? parsed.name : parsed.packageName)
|
|
21
|
-
// An explicit deployment project directory takes precedence over npm namespaces.
|
|
22
|
-
if (!projectName && type !== 'github' && parsed.scope) {
|
|
23
|
-
url.pathname = url.pathname.replace(/\/@[a-z\d._-]+\/*$/i, '')
|
|
24
|
-
}
|
|
25
|
-
const version = versioned && parsed.version && parsed.version.toLowerCase() !== 'latest' ? '@' + parsed.version : ''
|
|
26
|
-
url.pathname = url.pathname.replace(/\/+$/, '') + '/' + name + version
|
|
27
|
-
return url
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
module.exports = { HEL_BASES, packageRef, packageUrl }
|
|
1
|
+
// Shared by browser loading and Node env generation; no project-specific defaults.
|
|
2
|
+
const HEL_BASES = Object.freeze({ unpkg: 'https://unpkg.com' })
|
|
3
|
+
|
|
4
|
+
function packageRef(ref) {
|
|
5
|
+
const match = /^(?:(@[a-z\d._-]+)\/)?([a-z\d][a-z\d._-]*)(?:@([a-z\d][a-z\d.+_-]*))?$/i.exec(ref)
|
|
6
|
+
if (!match) throw new Error('无效的远程包名称或版本:' + ref)
|
|
7
|
+
const [, scope, name, version] = match
|
|
8
|
+
return { scope: scope || '', name, packageName: (scope ? scope + '/' : '') + name, version: version || '' }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Returns the package directory; callers select the output directory and entry. */
|
|
12
|
+
function packageUrl(parsed, { type = 'unpkg', base, projectName, versioned = true } = {}) {
|
|
13
|
+
const root = base || HEL_BASES[type]
|
|
14
|
+
|| (type === 'github' && parsed.scope ? 'https://' + parsed.scope.slice(1) + '.github.io' : '')
|
|
15
|
+
if (!root) throw new Error(type === 'github' ? 'github 无 scope 的包引用需要 base(无法推导组织)' : 'custom 加载需要 base')
|
|
16
|
+
let url
|
|
17
|
+
try { url = new URL(root) } catch { throw new Error('需要绝对 HTTP(S) 地址:' + root) }
|
|
18
|
+
if (!/^https?:$/.test(url.protocol)) throw new Error('不支持的地址协议:' + root)
|
|
19
|
+
if (url.search || url.hash) throw new Error('base 不能包含查询参数或 hash:' + root)
|
|
20
|
+
const name = projectName || (type === 'github' ? parsed.name : parsed.packageName)
|
|
21
|
+
// An explicit deployment project directory takes precedence over npm namespaces.
|
|
22
|
+
if (!projectName && type !== 'github' && parsed.scope) {
|
|
23
|
+
url.pathname = url.pathname.replace(/\/@[a-z\d._-]+\/*$/i, '')
|
|
24
|
+
}
|
|
25
|
+
const version = versioned && parsed.version && parsed.version.toLowerCase() !== 'latest' ? '@' + parsed.version : ''
|
|
26
|
+
url.pathname = url.pathname.replace(/\/+$/, '') + '/' + name + version
|
|
27
|
+
return url
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { HEL_BASES, packageRef, packageUrl }
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# 内置 Vue 文档解析器
|
|
2
|
-
|
|
3
|
-
此目录从 npm 发布包 `vdoc-parser@1.2.0` 的 `src/` 提取,作者:kennys wang <kennys_wang@163.com>,上游声明许可证为 **ISC**。
|
|
4
|
-
|
|
5
|
-
- 下载地址:`https://registry.npmjs.org/vdoc-parser/-/vdoc-parser-1.2.0.tgz`
|
|
6
|
-
- 上游 gitHead:`4723d6fc18be046e2546c3f9938bd7cb01487686`
|
|
7
|
-
- 发布包 SHA-1:`2bd4f9cdc6d20780220ea0150deb1b713d9a8c33`
|
|
8
|
-
- 发布包未包含独立 LICENSE 文件;此处保留其作者、许可证及源码出处信息。
|
|
9
|
-
|
|
10
|
-
本地适配:移除 TypeScript 类型语法,转换为可直接在 Node 中执行的 `.mjs` 源码;为相对导入补全扩展名,将 Node 内置模块改为 `node:` 前缀,并适配 Babel 7 generator 的 CommonJS 默认导出。解析算法不变,不再依赖或下载 `vdoc-parser` 包。
|
|
11
|
-
|
|
12
|
-
公共入口为 `@melt-js/libs-core/vdoc-parser`,保留 `parseCode`、`parseFile`、`parseFileSync`、`parseTypes`、`parseTypesFile`、`parseTypesFileSync`。该入口仅用于 Node 工具,不从 `libs-core` 的浏览器运行时入口导出。底层 Babel、SFC 编译器及 doctrine 由 `libs-core` 直接声明依赖。
|
|
13
|
-
|
|
1
|
+
# 内置 Vue 文档解析器
|
|
2
|
+
|
|
3
|
+
此目录从 npm 发布包 `vdoc-parser@1.2.0` 的 `src/` 提取,作者:kennys wang <kennys_wang@163.com>,上游声明许可证为 **ISC**。
|
|
4
|
+
|
|
5
|
+
- 下载地址:`https://registry.npmjs.org/vdoc-parser/-/vdoc-parser-1.2.0.tgz`
|
|
6
|
+
- 上游 gitHead:`4723d6fc18be046e2546c3f9938bd7cb01487686`
|
|
7
|
+
- 发布包 SHA-1:`2bd4f9cdc6d20780220ea0150deb1b713d9a8c33`
|
|
8
|
+
- 发布包未包含独立 LICENSE 文件;此处保留其作者、许可证及源码出处信息。
|
|
9
|
+
|
|
10
|
+
本地适配:移除 TypeScript 类型语法,转换为可直接在 Node 中执行的 `.mjs` 源码;为相对导入补全扩展名,将 Node 内置模块改为 `node:` 前缀,并适配 Babel 7 generator 的 CommonJS 默认导出。解析算法不变,不再依赖或下载 `vdoc-parser` 包。
|
|
11
|
+
|
|
12
|
+
公共入口为 `@melt-js/libs-core/vdoc-parser`,保留 `parseCode`、`parseFile`、`parseFileSync`、`parseTypes`、`parseTypesFile`、`parseTypesFileSync`。该入口仅用于 Node 工具,不从 `libs-core` 的浏览器运行时入口导出。底层 Babel、SFC 编译器及 doctrine 由 `libs-core` 直接声明依赖。
|
|
13
|
+
|
|
14
14
|
维护时直接修改本目录源码,并运行 `pnpm test`;调整发布内容后,还需执行 `pnpm pack` 并在仓库外验证安装。已有的上游限制(如部分负数默认值解析不完整)仍由 leva CLI 的 AST 补齐逻辑处理。
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
export const legalExtsReg = /\.(vue|ts|tsx|js|jsx)$/;
|
|
3
|
-
export const vueExtReg = /\.vue$/;
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
export const legalExtsReg = /\.(vue|ts|tsx|js|jsx)$/;
|
|
3
|
+
export const vueExtReg = /\.vue$/;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
/** Options and output shapes retained from vdoc-parser 1.2.0 (ISC). */
|
|
3
|
-
export interface Options {
|
|
4
|
-
exportType?: 'named' | 'default';
|
|
5
|
-
exportName?: string;
|
|
6
|
-
type?: 'component' | 'props';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface InternalOptions extends Options {
|
|
10
|
-
setup?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface BuiltinResult {
|
|
14
|
-
name: string;
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
default: string;
|
|
18
|
-
version: string;
|
|
19
|
-
required: 'true' | 'false';
|
|
20
|
-
isEvent: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type ParsedResult<T extends Record<string, string> = {}> = BuiltinResult & T;
|
|
24
|
-
|
|
25
|
-
export interface ParseTypesOptions {
|
|
26
|
-
names?: string[];
|
|
27
|
-
excludeNames?: string[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function parseCode(code: string, options?: InternalOptions): ParsedResult[];
|
|
31
|
-
export function parseFile(filePath: string, options?: Options): Promise<ParsedResult[]>;
|
|
32
|
-
export function parseFileSync(filePath: string, options?: Options): ParsedResult[];
|
|
33
|
-
export function parseTypes(code: string, options?: ParseTypesOptions): string | undefined;
|
|
34
|
-
export function parseTypesFile(filePath: string, options?: ParseTypesOptions): Promise<string | undefined>;
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
/** Options and output shapes retained from vdoc-parser 1.2.0 (ISC). */
|
|
3
|
+
export interface Options {
|
|
4
|
+
exportType?: 'named' | 'default';
|
|
5
|
+
exportName?: string;
|
|
6
|
+
type?: 'component' | 'props';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface InternalOptions extends Options {
|
|
10
|
+
setup?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BuiltinResult {
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
default: string;
|
|
18
|
+
version: string;
|
|
19
|
+
required: 'true' | 'false';
|
|
20
|
+
isEvent: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ParsedResult<T extends Record<string, string> = {}> = BuiltinResult & T;
|
|
24
|
+
|
|
25
|
+
export interface ParseTypesOptions {
|
|
26
|
+
names?: string[];
|
|
27
|
+
excludeNames?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function parseCode(code: string, options?: InternalOptions): ParsedResult[];
|
|
31
|
+
export function parseFile(filePath: string, options?: Options): Promise<ParsedResult[]>;
|
|
32
|
+
export function parseFileSync(filePath: string, options?: Options): ParsedResult[];
|
|
33
|
+
export function parseTypes(code: string, options?: ParseTypesOptions): string | undefined;
|
|
34
|
+
export function parseTypesFile(filePath: string, options?: ParseTypesOptions): Promise<string | undefined>;
|
|
35
35
|
export function parseTypesFileSync(filePath: string, options?: ParseTypesOptions): string | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
export { parseCode, parseFile, parseFileSync, parseTypes, parseTypesFileSync, parseTypesFile, } from './parsers/index.mjs';
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
export { parseCode, parseFile, parseFileSync, parseTypes, parseTypesFileSync, parseTypesFile, } from './parsers/index.mjs';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
export { parseCommentBlock } from './parseCommentBlock.mjs';
|
|
3
|
-
export { parseComponentOptions } from './parseComponentOptions.mjs';
|
|
4
|
-
export { parsePropType } from './parsePropType.mjs';
|
|
5
|
-
export { parseExport } from './parseExport.mjs';
|
|
6
|
-
export { parseSfc } from './parseSfc.mjs';
|
|
7
|
-
export { parseSetupScript } from './parseSetupScript.mjs';
|
|
8
|
-
export { parseProps } from './parseProps.mjs';
|
|
9
|
-
export { parseCode } from './parseCode.mjs';
|
|
10
|
-
export { parseFile } from './parseFile.mjs';
|
|
11
|
-
export { parseFileSync } from './parseFileSync.mjs';
|
|
12
|
-
export { parseTypes } from './parseTypes.mjs';
|
|
13
|
-
export { parseTypesFileSync } from './parseTypesFileSync.mjs';
|
|
14
|
-
export { parseTypesFile } from './parseTypesFile.mjs';
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
export { parseCommentBlock } from './parseCommentBlock.mjs';
|
|
3
|
+
export { parseComponentOptions } from './parseComponentOptions.mjs';
|
|
4
|
+
export { parsePropType } from './parsePropType.mjs';
|
|
5
|
+
export { parseExport } from './parseExport.mjs';
|
|
6
|
+
export { parseSfc } from './parseSfc.mjs';
|
|
7
|
+
export { parseSetupScript } from './parseSetupScript.mjs';
|
|
8
|
+
export { parseProps } from './parseProps.mjs';
|
|
9
|
+
export { parseCode } from './parseCode.mjs';
|
|
10
|
+
export { parseFile } from './parseFile.mjs';
|
|
11
|
+
export { parseFileSync } from './parseFileSync.mjs';
|
|
12
|
+
export { parseTypes } from './parseTypes.mjs';
|
|
13
|
+
export { parseTypesFileSync } from './parseTypesFileSync.mjs';
|
|
14
|
+
export { parseTypesFile } from './parseTypesFile.mjs';
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
import { parse as babelParse } from '@babel/parser';
|
|
3
|
-
import { parseExport } from './parseExport.mjs';
|
|
4
|
-
import { parseComponentOptions } from './parseComponentOptions.mjs';
|
|
5
|
-
import { parseSetupScript } from './parseSetupScript.mjs';
|
|
6
|
-
import { parseProps } from './parseProps.mjs';
|
|
7
|
-
export function parseCode(code, { exportType = 'default', exportName, type = 'component', setup = false, } = {
|
|
8
|
-
exportType: 'default',
|
|
9
|
-
type: 'component',
|
|
10
|
-
setup: false,
|
|
11
|
-
}) {
|
|
12
|
-
const res = babelParse(code, {
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
plugins: [
|
|
15
|
-
'typescript',
|
|
16
|
-
'jsx',
|
|
17
|
-
]
|
|
18
|
-
});
|
|
19
|
-
let propInfo;
|
|
20
|
-
if (setup) {
|
|
21
|
-
propInfo = parseSetupScript(res.program.body);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
if (type === 'props') {
|
|
25
|
-
const props = parseExport(res.program.body, exportType, type, exportName);
|
|
26
|
-
if (props) {
|
|
27
|
-
propInfo = parseProps(props);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (type === 'component') {
|
|
31
|
-
// 这里遵循一个文件只写一个组件的原则,不支持通过 exportName 查找导出的组件
|
|
32
|
-
const options = parseExport(res.program.body, exportType, type);
|
|
33
|
-
propInfo = options
|
|
34
|
-
? parseComponentOptions(options)
|
|
35
|
-
: undefined;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
throw new Error('Unknow parseType:' + type);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return propInfo || [];
|
|
42
|
-
}
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
import { parse as babelParse } from '@babel/parser';
|
|
3
|
+
import { parseExport } from './parseExport.mjs';
|
|
4
|
+
import { parseComponentOptions } from './parseComponentOptions.mjs';
|
|
5
|
+
import { parseSetupScript } from './parseSetupScript.mjs';
|
|
6
|
+
import { parseProps } from './parseProps.mjs';
|
|
7
|
+
export function parseCode(code, { exportType = 'default', exportName, type = 'component', setup = false, } = {
|
|
8
|
+
exportType: 'default',
|
|
9
|
+
type: 'component',
|
|
10
|
+
setup: false,
|
|
11
|
+
}) {
|
|
12
|
+
const res = babelParse(code, {
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
plugins: [
|
|
15
|
+
'typescript',
|
|
16
|
+
'jsx',
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
let propInfo;
|
|
20
|
+
if (setup) {
|
|
21
|
+
propInfo = parseSetupScript(res.program.body);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (type === 'props') {
|
|
25
|
+
const props = parseExport(res.program.body, exportType, type, exportName);
|
|
26
|
+
if (props) {
|
|
27
|
+
propInfo = parseProps(props);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (type === 'component') {
|
|
31
|
+
// 这里遵循一个文件只写一个组件的原则,不支持通过 exportName 查找导出的组件
|
|
32
|
+
const options = parseExport(res.program.body, exportType, type);
|
|
33
|
+
propInfo = options
|
|
34
|
+
? parseComponentOptions(options)
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new Error('Unknow parseType:' + type);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return propInfo || [];
|
|
42
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
import doctrine from 'doctrine';
|
|
3
|
-
export function parseCommentBlock(comment) {
|
|
4
|
-
const { tags } = doctrine.parse(`/*${comment.value}*/`, { unwrap: true });
|
|
5
|
-
return tags.reduce((acc, tag) => {
|
|
6
|
-
acc[tag.title] = tag.description || '';
|
|
7
|
-
return acc;
|
|
8
|
-
}, {});
|
|
9
|
-
}
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
import doctrine from 'doctrine';
|
|
3
|
+
export function parseCommentBlock(comment) {
|
|
4
|
+
const { tags } = doctrine.parse(`/*${comment.value}*/`, { unwrap: true });
|
|
5
|
+
return tags.reduce((acc, tag) => {
|
|
6
|
+
acc[tag.title] = tag.description || '';
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
-
import { isObjectExpression, } from '@babel/types';
|
|
3
|
-
import { getPropertyByExpression } from '../utils.mjs';
|
|
4
|
-
import { parseProps } from './parseProps.mjs';
|
|
5
|
-
export function parseComponentOptions(options) {
|
|
6
|
-
const props = getPropertyByExpression(options, 'props');
|
|
7
|
-
if (!props)
|
|
8
|
-
return;
|
|
9
|
-
if (isObjectExpression(props.value)) {
|
|
10
|
-
return parseProps(props.value);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
// Derived from vdoc-parser 1.2.0 by kennys wang (ISC); see NOTICE.md.
|
|
2
|
+
import { isObjectExpression, } from '@babel/types';
|
|
3
|
+
import { getPropertyByExpression } from '../utils.mjs';
|
|
4
|
+
import { parseProps } from './parseProps.mjs';
|
|
5
|
+
export function parseComponentOptions(options) {
|
|
6
|
+
const props = getPropertyByExpression(options, 'props');
|
|
7
|
+
if (!props)
|
|
8
|
+
return;
|
|
9
|
+
if (isObjectExpression(props.value)) {
|
|
10
|
+
return parseProps(props.value);
|
|
11
|
+
}
|
|
12
|
+
}
|