@kite3d/engine 0.15.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/authoring.d.ts +54 -0
- package/dist/authoring.js +165 -0
- package/dist/authoring.js.map +1 -0
- package/dist/authoringValidation.d.ts +110 -0
- package/dist/authoringValidation.js +488 -0
- package/dist/authoringValidation.js.map +1 -0
- package/dist/defaults.d.ts +2 -0
- package/dist/fileTypes.d.ts +5 -0
- package/dist/fileTypes.js +51 -0
- package/dist/fileTypes.js.map +1 -0
- package/dist/importMap.d.ts +15 -0
- package/dist/importMap.js +62 -0
- package/dist/importMap.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2756 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations.js +5 -0
- package/dist/migrations.js.map +1 -0
- package/dist/paths.d.ts +9 -0
- package/dist/paths.js +13 -0
- package/dist/paths.js.map +1 -0
- package/dist/plugins/GeneratorComponent.d.ts +40 -0
- package/dist/plugins/HtmlUiComponent.d.ts +52 -0
- package/dist/plugins/HtmlUiComponent.example.d.ts +0 -0
- package/dist/plugins/cannon/Cannon3DBodyComponent.d.ts +27 -0
- package/dist/plugins/cannon/Cannon3DShapeComponent.d.ts +57 -0
- package/dist/plugins/cannon/CannonPhysicsPlugin.d.ts +63 -0
- package/dist/plugins/cannon/CannonRagdollComponent.d.ts +148 -0
- package/dist/plugins/cannon/helper.d.ts +24 -0
- package/dist/plugins/cannon/threeToCannon.d.ts +63 -0
- package/dist/plugins/cannon/utils.d.ts +9 -0
- package/dist/projectFormat.js +108 -0
- package/dist/projectFormat.js.map +1 -0
- package/dist/runtime/createGame.d.ts +29 -0
- package/dist/runtime/index.d.ts +18 -0
- package/dist/runtime/migrations.d.ts +5 -0
- package/dist/runtime/nestedAssets.d.ts +26 -0
- package/dist/runtime/projectFormat.d.ts +83 -0
- package/dist/runtime/version.d.ts +1 -0
- package/dist/runtime.js +72835 -0
- package/dist/runtime.js.map +1 -0
- package/dist/sceneSerialization.d.ts +17 -0
- package/dist/sceneSerialization.js +174 -0
- package/dist/sceneSerialization.js.map +1 -0
- package/dist/scripts.d.ts +17 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +86 -0
- package/src/authoring.ts +293 -0
- package/src/authoringValidation.ts +815 -0
- package/src/defaults.ts +277 -0
- package/src/fileTypes.ts +53 -0
- package/src/importMap.ts +105 -0
- package/src/index.ts +15 -0
- package/src/paths.ts +9 -0
- package/src/plugins/GeneratorComponent.ts +275 -0
- package/src/plugins/HtmlUiComponent.example.ts +202 -0
- package/src/plugins/HtmlUiComponent.md +219 -0
- package/src/plugins/HtmlUiComponent.ts +320 -0
- package/src/plugins/cannon/Cannon3DBodyComponent.ts +227 -0
- package/src/plugins/cannon/Cannon3DShapeComponent.ts +258 -0
- package/src/plugins/cannon/CannonPhysicsPlugin.ts +409 -0
- package/src/plugins/cannon/CannonRagdollComponent.ts +1170 -0
- package/src/plugins/cannon/helper.ts +255 -0
- package/src/plugins/cannon/threeToCannon.ts +441 -0
- package/src/plugins/cannon/utils.ts +185 -0
- package/src/runtime/createGame.ts +337 -0
- package/src/runtime/index.ts +19 -0
- package/src/runtime/migrations.ts +6 -0
- package/src/runtime/nestedAssets.ts +226 -0
- package/src/runtime/projectFormat.ts +233 -0
- package/src/runtime/version.ts +3 -0
- package/src/sceneSerialization.ts +289 -0
- package/src/scripts.ts +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectFormat.js","sources":["../src/runtime/projectFormat.ts"],"sourcesContent":["import {parse, ParseError} from 'jsonc-parser'\n\nexport const settingsKey = 'kite3d'\nexport const assetUrlPrefix = `/${settingsKey}/`\n\nexport type JSONValue = string | number | boolean | null | JSONValue[] | {[key: string]: JSONValue}\nexport type ProjectPackageJSON = Record<string, JSONValue> & {mainScene: string}\n\nexport interface ProjectGeneratorState {\n componentId: string\n module: string\n nodeIndex: number\n nodeName: string\n params: Record<string, unknown>\n}\n\nexport interface AssetsJSONManifest {\n files: Record<string, {\n path: string\n }>\n version: number\n}\n\nexport interface ProjectDependency {\n key: string\n version: string\n url?: string\n}\n\nexport interface ExternalPlugin {\n import: string\n /** @default `default` */\n className?: string\n /** @default true */\n active?: boolean\n /** Constructor parameters. */\n params?: JSONValue[]\n}\n\nexport interface ExternalScript {\n import: string\n /** @default true */\n active?: boolean\n}\n\nexport interface ProjectViewerSettings {\n msaa?: boolean\n rgbm?: boolean\n zPrepass?: boolean\n renderScale?: number | 'auto'\n maxRenderScale?: number\n backgroundColor?: string | number | null\n modelRootScale?: number\n stencil?: boolean\n debug?: boolean\n tonemap?: boolean\n camera?: {\n type?: 'perspective' | 'orthographic'\n controlsMode?: string\n position?: [number, number, number]\n target?: [number, number, number]\n }\n maxHDRIntensity?: number\n powerPreference?: 'default' | 'high-performance' | 'low-power'\n}\n\nexport interface ProjectConfigSettings {\n plugins: ExternalPlugin[]\n scripts: ExternalScript[]\n dependencies: ProjectDependency[]\n viewer: ProjectViewerSettings\n}\n\nexport interface ProjectConfigSettingsJSON {\n plugins?: (ExternalPlugin | string)[]\n imports?: Record<string, string>\n scripts?: (ExternalScript | string)[]\n viewer?: ProjectViewerSettings\n}\n\n/** A configured script or plugin is package-backed only when it names a declared dependency exactly. */\nexport function isDependencyModuleSpecifier(\n specifier: string,\n packageJson: ProjectPackageJSON,\n): boolean {\n const dependencies = packageJson.dependencies\n return isRecord(dependencies) && Object.prototype.hasOwnProperty.call(dependencies, specifier)\n}\n\nexport function parsePackageJSON(text: string): ProjectPackageJSON {\n const json = parse(text) as unknown\n if (!json || typeof json !== 'object' || Array.isArray(json)) {\n throw new Error('Invalid package.json file: expected an object')\n }\n const packageJson = json as ProjectPackageJSON\n if (typeof packageJson.mainScene !== 'string' || !packageJson.mainScene.toLowerCase().endsWith('.gltf')) {\n throw new Error('package.json mainScene must name a text .gltf file')\n }\n return packageJson\n}\n\nexport function parseAssetsJSONManifest(text: string): AssetsJSONManifest {\n const json = parse(text) as AssetsJSONManifest\n\n if (json.files && typeof json.files !== 'object') {\n throw new Error('Invalid assets.json file: files should be an object')\n }\n if (json.version !== undefined && typeof json.version !== 'number') {\n throw new Error('Invalid assets.json file: version should be a number')\n }\n\n if (!json.files) json.files = {}\n if (!json.version) json.version = 1\n\n return json\n}\n\nexport function validateSceneSource(path: string, text: string): void {\n const document = JSON.parse(text) as {asset?: unknown}\n if (!document || typeof document !== 'object' || !document.asset) {\n throw new Error(`${path} is not a JSON glTF document`)\n }\n}\n\nexport function readProjectGeneratorStates(text: string): ProjectGeneratorState[] {\n try {\n const document = JSON.parse(text) as {\n nodes?: Array<{\n name?: unknown\n extras?: {EntityComponentPlugin?: Record<string, {type?: unknown, state?: unknown}>}\n }>\n }\n const generators: ProjectGeneratorState[] = []\n for (const [nodeIndex, node] of (document.nodes || []).entries()) {\n for (const [componentId, component] of Object.entries(node.extras?.EntityComponentPlugin || {})) {\n if (component.type !== 'Generator' || !isRecord(component.state)) continue\n generators.push({\n componentId,\n module: typeof component.state.module === 'string' ? component.state.module : '',\n nodeIndex,\n nodeName: typeof node.name === 'string' ? node.name : `Node ${nodeIndex}`,\n params: isRecord(component.state.params) ? component.state.params : {},\n })\n }\n }\n return generators\n } catch {\n return []\n }\n}\n\nexport function updateProjectGeneratorState(\n text: string,\n generator: Pick<ProjectGeneratorState, 'componentId' | 'nodeIndex' | 'nodeName'>,\n update: Partial<Pick<ProjectGeneratorState, 'module' | 'params'>>,\n): {text: string, state: Record<string, unknown>} {\n const document = JSON.parse(text) as {\n nodes?: Array<{extras?: {EntityComponentPlugin?: Record<string, {state?: unknown}>}}>\n }\n const state = document.nodes?.[generator.nodeIndex]?.extras?.EntityComponentPlugin?.[generator.componentId]?.state\n if (!isRecord(state)) throw new Error(`Generator component is missing on ${generator.nodeName}`)\n Object.assign(state, update)\n return {text: JSON.stringify(document, null, 2), state}\n}\n\nexport async function parsePackageJsonSettingsConfig(json: ProjectPackageJSON, _project?: unknown): Promise<ProjectConfigSettings> {\n const config = (json[settingsKey] ?? {}) as ProjectConfigSettingsJSON\n const dependencies: ProjectDependency[] = []\n const packageDependencies = json.dependencies && typeof json.dependencies === 'object' && !Array.isArray(json.dependencies)\n ? json.dependencies as Record<string, string>\n : {}\n const deps: Record<string, string> = {\n ...packageDependencies,\n }\n\n dependencies.push(...Object.entries(deps).map(([key, version]) => ({key, version})))\n\n if (config.imports) {\n dependencies.push(...Object.entries(config.imports).map(([key, url]) => ({\n key,\n url: !url.startsWith('@') ? url : undefined,\n version: url.startsWith('@') ? url.slice(1) : '',\n })))\n }\n\n const plugins = config.plugins?.map((entry) => {\n if (typeof entry !== 'string') return entry\n\n const match = entry.match(/\\((.*)\\)$/)\n let params: JSONValue[] | undefined\n let spec = entry\n\n if (match) {\n const paramString = match[1].trim()\n spec = entry.slice(0, match.index).trim()\n if (paramString) {\n try {\n const errors: ParseError[] = []\n params = parse(`[${paramString}]`, errors)\n if (!Array.isArray(params) || errors.length) {\n console.error(errors)\n throw new Error('Plugin params is not a valid array')\n }\n } catch (error) {\n console.error('Unable to parse plugin params, skipping plugin', entry, paramString, error)\n return null\n }\n }\n }\n\n const separator = spec.lastIndexOf(':')\n return {\n import: separator !== -1 ? spec.slice(0, separator) : spec,\n className: separator !== -1 ? spec.slice(separator + 1) : undefined,\n params,\n } satisfies ExternalPlugin\n }) || []\n\n const scripts = config.scripts?.map((entry) =>\n typeof entry === 'string' ? {import: entry} : entry\n ) || []\n\n return {\n plugins: plugins.filter(Boolean) as ExternalPlugin[],\n scripts,\n dependencies,\n viewer: config.viewer || {},\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value)\n}\n"],"names":["settingsKey","assetUrlPrefix","isDependencyModuleSpecifier","specifier","packageJson","dependencies","isRecord","parsePackageJSON","text","json","parse","parseAssetsJSONManifest","validateSceneSource","path","document","readProjectGeneratorStates","generators","nodeIndex","node","componentId","component","_a","updateProjectGeneratorState","generator","update","state","_e","_d","_c","_b","parsePackageJsonSettingsConfig","_project","config","deps","key","version","url","plugins","entry","match","params","spec","paramString","errors","error","separator","scripts","value"],"mappings":";AAEO,MAAMA,IAAc,UACdC,IAAiB,IAAID,CAAW;AA8EtC,SAASE,EACZC,GACAC,GACO;AACP,QAAMC,IAAeD,EAAY;AACjC,SAAOE,EAASD,CAAY,KAAK,OAAO,UAAU,eAAe,KAAKA,GAAcF,CAAS;AACjG;AAEO,SAASI,EAAiBC,GAAkC;AAC/D,QAAMC,IAAOC,EAAMF,CAAI;AACvB,MAAI,CAACC,KAAQ,OAAOA,KAAS,YAAY,MAAM,QAAQA,CAAI;AACvD,UAAM,IAAI,MAAM,+CAA+C;AAEnE,QAAML,IAAcK;AACpB,MAAI,OAAOL,EAAY,aAAc,YAAY,CAACA,EAAY,UAAU,YAAA,EAAc,SAAS,OAAO;AAClG,UAAM,IAAI,MAAM,oDAAoD;AAExE,SAAOA;AACX;AAEO,SAASO,EAAwBH,GAAkC;AACtE,QAAMC,IAAOC,EAAMF,CAAI;AAEvB,MAAIC,EAAK,SAAS,OAAOA,EAAK,SAAU;AACpC,UAAM,IAAI,MAAM,qDAAqD;AAEzE,MAAIA,EAAK,YAAY,UAAa,OAAOA,EAAK,WAAY;AACtD,UAAM,IAAI,MAAM,sDAAsD;AAG1E,SAAKA,EAAK,UAAOA,EAAK,QAAQ,CAAA,IACzBA,EAAK,YAASA,EAAK,UAAU,IAE3BA;AACX;AAEO,SAASG,EAAoBC,GAAcL,GAAoB;AAClE,QAAMM,IAAW,KAAK,MAAMN,CAAI;AAChC,MAAI,CAACM,KAAY,OAAOA,KAAa,YAAY,CAACA,EAAS;AACvD,UAAM,IAAI,MAAM,GAAGD,CAAI,8BAA8B;AAE7D;AAEO,SAASE,EAA2BP,GAAuC;;AAC9E,MAAI;AACA,UAAMM,IAAW,KAAK,MAAMN,CAAI,GAM1BQ,IAAsC,CAAA;AAC5C,eAAW,CAACC,GAAWC,CAAI,MAAMJ,E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;AAAA,MAC1D,QAAAL;AAAA,IAAA;AAAA,EAER,OAAM,CAAA,GAEAM,MAAUjB,IAAAG,EAAO,YAAP,gBAAAH,EAAgB;AAAA,IAAI,CAACS,MACjC,OAAOA,KAAU,WAAW,EAAC,QAAQA,MAASA;AAAA,QAC7C,CAAA;AAEL,SAAO;AAAA,IACH,SAASD,EAAQ,OAAO,OAAO;AAAA,IAC/B,SAAAS;AAAA,IACA,cAAAzC;AAAA,IACA,QAAQ2B,EAAO,UAAU,CAAA;AAAA,EAAC;AAElC;AAEA,SAAS1B,EAASyC,GAAkD;AAChE,SAAO,EAAQA,KAAU,OAAOA,KAAU,YAAY,CAAC,MAAM,QAAQA,CAAK;AAC9E;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ThreeViewer } from 'threepipe';
|
|
2
|
+
import { GameValidationFunction, GameValidationReport, RuntimeCleanupReport } from '../authoringValidation.ts';
|
|
3
|
+
import { AssetsJSONManifest, ProjectPackageJSON, ProjectConfigSettings } from './projectFormat.ts';
|
|
4
|
+
export interface CreateGameOptions {
|
|
5
|
+
base: string;
|
|
6
|
+
canvas: HTMLCanvasElement;
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
/** Content hashes for cache-safe project module imports in development. */
|
|
9
|
+
fileRevisions?: Readonly<Record<string, string>>;
|
|
10
|
+
/** Identifies one module-graph load so transitive imports bypass the browser module map together. */
|
|
11
|
+
moduleRevision?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RuntimeProject {
|
|
14
|
+
packageJson: ProjectPackageJSON;
|
|
15
|
+
config: ProjectConfigSettings;
|
|
16
|
+
assetsManifest: AssetsJSONManifest;
|
|
17
|
+
mainScene: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CreatedGame {
|
|
20
|
+
viewer: ThreeViewer;
|
|
21
|
+
project: RuntimeProject;
|
|
22
|
+
registerGameValidation(fn: GameValidationFunction): () => void;
|
|
23
|
+
publishGameTelemetry(value: object): () => void;
|
|
24
|
+
runGameValidation(): Promise<GameValidationReport>;
|
|
25
|
+
dispose(): RuntimeCleanupReport;
|
|
26
|
+
}
|
|
27
|
+
export declare function createGame(options: CreateGameOptions): Promise<CreatedGame>;
|
|
28
|
+
/** Load the saved project and generator previews without starting components, physics, the timeline, or main.js. */
|
|
29
|
+
export declare function createStoppedGame(options: CreateGameOptions): Promise<CreatedGame>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { createGame, createStoppedGame } from './createGame.ts';
|
|
2
|
+
export type { CreatedGame, CreateGameOptions, RuntimeProject } from './createGame.ts';
|
|
3
|
+
export { RUNTIME_VERSION } from './version.ts';
|
|
4
|
+
export * from './projectFormat.ts';
|
|
5
|
+
export * from './migrations.ts';
|
|
6
|
+
export { RuntimeNestedAssetLoader } from './nestedAssets.ts';
|
|
7
|
+
export { registerScripts, walkScriptExports } from '../scripts.ts';
|
|
8
|
+
export { HtmlUiComponent } from '../plugins/HtmlUiComponent.ts';
|
|
9
|
+
export { GeneratorComponent, markGenerated, removeGeneratedChildren, resolveGeneratorModule, runGenerator } from '../plugins/GeneratorComponent.ts';
|
|
10
|
+
export type { GeneratorContext, GeneratorModule, GeneratorParams, GeneratorViewerOptions, RunGeneratorOptions } from '../plugins/GeneratorComponent.ts';
|
|
11
|
+
export { CannonPhysicsPlugin } from '../plugins/cannon/CannonPhysicsPlugin.ts';
|
|
12
|
+
export { serializeSceneGltf, serializeSceneGltfDocument } from '../sceneSerialization.ts';
|
|
13
|
+
export type { SerializeSceneGltfOptions, SerializedSceneFile, SerializedSceneGltf } from '../sceneSerialization.ts';
|
|
14
|
+
export * from '../authoring.ts';
|
|
15
|
+
export * from '../authoringValidation.ts';
|
|
16
|
+
export * from 'threepipe';
|
|
17
|
+
export * from 'uiconfig.js';
|
|
18
|
+
export * from 'ts-browser-helpers';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IObject3D, ThreeViewer } from 'threepipe';
|
|
2
|
+
type RuntimeErrorHandler = (error: unknown) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Loads the embedded rootPath references written by the editor's AssetTracker.
|
|
5
|
+
* This is deliberately runtime-only: it keeps root overrides, but has no file
|
|
6
|
+
* watching, picking, export hooks, refresh subscriptions, or editor registry.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RuntimeNestedAssetLoader {
|
|
9
|
+
private readonly viewer;
|
|
10
|
+
private readonly onError;
|
|
11
|
+
private readonly importer;
|
|
12
|
+
private readonly cache;
|
|
13
|
+
private readonly pending;
|
|
14
|
+
constructor(viewer: ThreeViewer, onError: RuntimeErrorHandler);
|
|
15
|
+
dispose(): void;
|
|
16
|
+
loadObjectDependencies(object: IObject3D): Promise<void>;
|
|
17
|
+
waitForPending(): Promise<void>;
|
|
18
|
+
private readonly onProcessRaw;
|
|
19
|
+
private isEmbeddedReference;
|
|
20
|
+
private loadAsset;
|
|
21
|
+
private loadReference;
|
|
22
|
+
private updateObject;
|
|
23
|
+
private updateMaterial;
|
|
24
|
+
private track;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const settingsKey = "kite3d";
|
|
2
|
+
export declare const assetUrlPrefix = "/kite3d/";
|
|
3
|
+
export type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
4
|
+
[key: string]: JSONValue;
|
|
5
|
+
};
|
|
6
|
+
export type ProjectPackageJSON = Record<string, JSONValue> & {
|
|
7
|
+
mainScene: string;
|
|
8
|
+
};
|
|
9
|
+
export interface ProjectGeneratorState {
|
|
10
|
+
componentId: string;
|
|
11
|
+
module: string;
|
|
12
|
+
nodeIndex: number;
|
|
13
|
+
nodeName: string;
|
|
14
|
+
params: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface AssetsJSONManifest {
|
|
17
|
+
files: Record<string, {
|
|
18
|
+
path: string;
|
|
19
|
+
}>;
|
|
20
|
+
version: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ProjectDependency {
|
|
23
|
+
key: string;
|
|
24
|
+
version: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ExternalPlugin {
|
|
28
|
+
import: string;
|
|
29
|
+
/** @default `default` */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** @default true */
|
|
32
|
+
active?: boolean;
|
|
33
|
+
/** Constructor parameters. */
|
|
34
|
+
params?: JSONValue[];
|
|
35
|
+
}
|
|
36
|
+
export interface ExternalScript {
|
|
37
|
+
import: string;
|
|
38
|
+
/** @default true */
|
|
39
|
+
active?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ProjectViewerSettings {
|
|
42
|
+
msaa?: boolean;
|
|
43
|
+
rgbm?: boolean;
|
|
44
|
+
zPrepass?: boolean;
|
|
45
|
+
renderScale?: number | 'auto';
|
|
46
|
+
maxRenderScale?: number;
|
|
47
|
+
backgroundColor?: string | number | null;
|
|
48
|
+
modelRootScale?: number;
|
|
49
|
+
stencil?: boolean;
|
|
50
|
+
debug?: boolean;
|
|
51
|
+
tonemap?: boolean;
|
|
52
|
+
camera?: {
|
|
53
|
+
type?: 'perspective' | 'orthographic';
|
|
54
|
+
controlsMode?: string;
|
|
55
|
+
position?: [number, number, number];
|
|
56
|
+
target?: [number, number, number];
|
|
57
|
+
};
|
|
58
|
+
maxHDRIntensity?: number;
|
|
59
|
+
powerPreference?: 'default' | 'high-performance' | 'low-power';
|
|
60
|
+
}
|
|
61
|
+
export interface ProjectConfigSettings {
|
|
62
|
+
plugins: ExternalPlugin[];
|
|
63
|
+
scripts: ExternalScript[];
|
|
64
|
+
dependencies: ProjectDependency[];
|
|
65
|
+
viewer: ProjectViewerSettings;
|
|
66
|
+
}
|
|
67
|
+
export interface ProjectConfigSettingsJSON {
|
|
68
|
+
plugins?: (ExternalPlugin | string)[];
|
|
69
|
+
imports?: Record<string, string>;
|
|
70
|
+
scripts?: (ExternalScript | string)[];
|
|
71
|
+
viewer?: ProjectViewerSettings;
|
|
72
|
+
}
|
|
73
|
+
/** A configured script or plugin is package-backed only when it names a declared dependency exactly. */
|
|
74
|
+
export declare function isDependencyModuleSpecifier(specifier: string, packageJson: ProjectPackageJSON): boolean;
|
|
75
|
+
export declare function parsePackageJSON(text: string): ProjectPackageJSON;
|
|
76
|
+
export declare function parseAssetsJSONManifest(text: string): AssetsJSONManifest;
|
|
77
|
+
export declare function validateSceneSource(path: string, text: string): void;
|
|
78
|
+
export declare function readProjectGeneratorStates(text: string): ProjectGeneratorState[];
|
|
79
|
+
export declare function updateProjectGeneratorState(text: string, generator: Pick<ProjectGeneratorState, 'componentId' | 'nodeIndex' | 'nodeName'>, update: Partial<Pick<ProjectGeneratorState, 'module' | 'params'>>): {
|
|
80
|
+
text: string;
|
|
81
|
+
state: Record<string, unknown>;
|
|
82
|
+
};
|
|
83
|
+
export declare function parsePackageJsonSettingsConfig(json: ProjectPackageJSON, _project?: unknown): Promise<ProjectConfigSettings>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RUNTIME_VERSION: string;
|