@undefineds.co/xpod 0.3.24 → 0.3.25
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.
|
@@ -24,5 +24,5 @@ export interface RuntimeBootstrapState {
|
|
|
24
24
|
export declare function resolveRuntimeBootstrap(id: string, options: XpodRuntimeOptions, host: RuntimeHost, platform?: RuntimePlatform): Promise<RuntimeBootstrapState>;
|
|
25
25
|
export declare function buildRuntimeEnv(state: RuntimeBootstrapState, options: XpodRuntimeOptions, envFromFile?: Record<string, string | undefined>): Record<string, string | undefined>;
|
|
26
26
|
export declare function buildRuntimeShorthand(runtimeEnv: Record<string, string | undefined>, options: XpodRuntimeOptions, state: RuntimeBootstrapState, baseEnv?: Record<string, string | undefined>): Record<string, string | number | boolean>;
|
|
27
|
-
export declare function createCssRuntimeConfig(state: RuntimeBootstrapState, open: boolean, platform?: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'writeTextFile'>): string;
|
|
27
|
+
export declare function createCssRuntimeConfig(state: RuntimeBootstrapState, open: boolean, platform?: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>): string;
|
|
28
28
|
export declare function initRuntimeLogger(level: string, platform?: Pick<RuntimePlatform, 'cwd' | 'joinPath'>): void;
|
|
@@ -215,18 +215,56 @@ function createCssRuntimeConfig(state, open, platform = NodeRuntimePlatform_1.no
|
|
|
215
215
|
})()
|
|
216
216
|
: normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));
|
|
217
217
|
const openConfigPath = normalizeWindowsAbsolutePath(platform.joinPath(package_root_1.PACKAGE_ROOT, 'config/runtime-open.json'));
|
|
218
|
+
const runtimeConfigDir = platform.dirname(runtimeConfigPath);
|
|
219
|
+
const runtimeConfigImportPath = rewriteConfigForFileUrlImportsIfNeeded(configPath, platform.joinPath(runtimeConfigDir, 'config'), platform);
|
|
218
220
|
platform.writeTextFile(runtimeConfigPath, JSON.stringify({
|
|
219
221
|
'@context': [
|
|
220
222
|
'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',
|
|
221
223
|
'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',
|
|
222
224
|
],
|
|
223
225
|
import: [
|
|
224
|
-
toConfigImportSpecifier(runtimeConfigPath,
|
|
226
|
+
toConfigImportSpecifier(runtimeConfigPath, runtimeConfigImportPath),
|
|
225
227
|
toConfigImportSpecifier(runtimeConfigPath, openConfigPath),
|
|
226
228
|
],
|
|
227
229
|
}, null, 2));
|
|
228
230
|
return runtimeConfigPath;
|
|
229
231
|
}
|
|
232
|
+
function rewriteConfigForFileUrlImportsIfNeeded(configPath, outputDir, platform, rewritten = new Map()) {
|
|
233
|
+
const normalizedConfigPath = normalizeWindowsAbsolutePath(configPath);
|
|
234
|
+
if (isWindowsAbsolutePath(normalizedConfigPath) || !pathNeedsEscapedFileUrl(normalizedConfigPath)) {
|
|
235
|
+
return normalizedConfigPath;
|
|
236
|
+
}
|
|
237
|
+
const existing = rewritten.get(normalizedConfigPath);
|
|
238
|
+
if (existing) {
|
|
239
|
+
return existing;
|
|
240
|
+
}
|
|
241
|
+
platform.ensureDir(outputDir);
|
|
242
|
+
const outputPath = normalizeWindowsAbsolutePath(platform.joinPath(outputDir, node_path_1.default.posix.basename(normalizedConfigPath)));
|
|
243
|
+
rewritten.set(normalizedConfigPath, outputPath);
|
|
244
|
+
const parsed = JSON.parse(platform.readTextFile(normalizedConfigPath));
|
|
245
|
+
parsed.import = rewriteConfigImports(normalizedConfigPath, parsed.import, outputDir, platform, rewritten);
|
|
246
|
+
platform.writeTextFile(outputPath, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
247
|
+
return outputPath;
|
|
248
|
+
}
|
|
249
|
+
function rewriteConfigImports(sourceConfigPath, imports, outputDir, platform, rewritten) {
|
|
250
|
+
if (typeof imports === 'string') {
|
|
251
|
+
return rewriteConfigImport(sourceConfigPath, imports, outputDir, platform, rewritten);
|
|
252
|
+
}
|
|
253
|
+
if (Array.isArray(imports)) {
|
|
254
|
+
return imports.map((value) => typeof value === 'string'
|
|
255
|
+
? rewriteConfigImport(sourceConfigPath, value, outputDir, platform, rewritten)
|
|
256
|
+
: value);
|
|
257
|
+
}
|
|
258
|
+
return imports;
|
|
259
|
+
}
|
|
260
|
+
function rewriteConfigImport(sourceConfigPath, importValue, outputDir, platform, rewritten) {
|
|
261
|
+
if (!importValue.startsWith('./') && !importValue.startsWith('../')) {
|
|
262
|
+
return importValue;
|
|
263
|
+
}
|
|
264
|
+
const targetPath = normalizeWindowsAbsolutePath(node_path_1.default.posix.resolve(platform.dirname(sourceConfigPath), importValue));
|
|
265
|
+
const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, platform, rewritten);
|
|
266
|
+
return (0, node_url_1.pathToFileURL)(rewrittenTargetPath).href;
|
|
267
|
+
}
|
|
230
268
|
function initRuntimeLogger(level, platform = NodeRuntimePlatform_1.nodeRuntimePlatform) {
|
|
231
269
|
const loggerFactory = new ConfigurableLoggerFactory_1.ConfigurableLoggerFactory(level, {
|
|
232
270
|
fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":";;;;;AAgHA,0DAoEC;AAED,0CAgCC;AAED,sDA4CC;AAED,wDAoCC;AAED,8CASC;AArTD,iEAA+D;AAC/D,0DAA6B;AAC7B,uCAAyC;AACzC,oFAAiF;AACjF,iDAA8C;AAE9C,+CAA6E;AAC7E,6EAA0E;AAyB1E,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CA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from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { ConfigurableLoggerFactory } from '../logging/ConfigurableLoggerFactory';\nimport { PACKAGE_ROOT } from './package-root';\nimport type { RuntimeHost } from './host/types';\nimport { oidcTokenEndpoint, resolveExternalOidcIssuer } from './oidc-issuer';\nimport { nodeRuntimePlatform } from './platform/node/NodeRuntimePlatform';\nimport type { RuntimePlatform } from './platform/types';\nimport type { XpodRuntimeOptions, XpodRuntimePorts, XpodRuntimeSockets } from './runtime-types';\n\nexport interface RuntimeBootstrapState {\n id: string;\n host: RuntimeHost;\n mode: 'local' | 'cloud';\n transport: 'socket' | 'port';\n bindHost: string;\n runtimeRoot: string;\n rootFilePath: string;\n sparqlEndpoint: string;\n rdfIndexPath: string;\n identityDbUrl: string;\n usageDbUrl: string;\n cssAuthMode: 'acp' | 'acl' | 'allow-all';\n apiOpen: boolean;\n logLevel: string;\n baseUrl: string;\n envFilePath?: string;\n ports: XpodRuntimePorts;\n sockets: XpodRuntimeSockets;\n}\n\nfunction ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : `${url}/`;\n}\n\nfunction normalizeWindowsAbsolutePath(filePath: string): string {\n return filePath.replace(/^[\\\\/]+(?=[A-Za-z]:[\\\\/])/, '');\n}\n\nfunction isWindowsAbsolutePath(filePath: string): boolean {\n return /^[A-Za-z]:[\\\\/]/.test(normalizeWindowsAbsolutePath(filePath));\n}\n\nfunction getWindowsDriveRoot(filePath: string): string | undefined {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath);\n return isWindowsAbsolutePath(normalizedPath) ? path.win32.parse(normalizedPath).root.toLowerCase() : undefined;\n}\n\nfunction arePathsOnDifferentWindowsDrives(firstPath: string, secondPath: string): boolean {\n const firstRoot = getWindowsDriveRoot(firstPath);\n const secondRoot = getWindowsDriveRoot(secondPath);\n return Boolean(firstRoot && secondRoot && firstRoot !== secondRoot);\n}\n\nfunction toWindowsFileUrl(filePath: string): string {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath).replace(/\\\\/g, '/');\n return new URL(`file:///${normalizedPath}`).href;\n}\n\nfunction toConfigImportSpecifier(fromFilePath: string, toFilePath: string): string {\n const normalizedFromPath = normalizeWindowsAbsolutePath(fromFilePath);\n const normalizedToPath = normalizeWindowsAbsolutePath(toFilePath);\n if (!isWindowsAbsolutePath(normalizedFromPath) && (pathNeedsEscapedFileUrl(normalizedFromPath) || pathNeedsEscapedFileUrl(normalizedToPath))) {\n return pathToFileURL(normalizedToPath).href;\n }\n\n const useWindowsPaths = isWindowsAbsolutePath(normalizedFromPath) || isWindowsAbsolutePath(normalizedToPath);\n const pathApi = useWindowsPaths ? path.win32 : path.posix;\n const fromDirectoryPath = pathApi.dirname(useWindowsPaths ? normalizedFromPath : fromFilePath);\n const targetPath = useWindowsPaths ? normalizedToPath : toFilePath;\n\n if (useWindowsPaths && arePathsOnDifferentWindowsDrives(fromDirectoryPath, targetPath)) {\n return toWindowsFileUrl(targetPath);\n }\n\n const relativePath = pathApi.relative(fromDirectoryPath, targetPath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nfunction withDefinedEntries(entries: Array<[string, string | number | boolean | undefined]>): Record<string, string | number | boolean> {\n const result: Record<string, string | number | boolean> = {};\n for (const [key, value] of entries) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeDatabaseUrl(\n value: string,\n platform: Pick<RuntimePlatform, 'resolvePath'> = nodeRuntimePlatform,\n): string {\n if (\n value.startsWith('sqlite:') ||\n value.startsWith('postgres://') ||\n value.startsWith('postgresql://') ||\n value.startsWith('mysql://')\n ) {\n return value;\n }\n return `sqlite:${platform.resolvePath(value)}`;\n}\n\nexport async function resolveRuntimeBootstrap(\n id: string,\n options: XpodRuntimeOptions,\n host: RuntimeHost,\n platform: RuntimePlatform = nodeRuntimePlatform,\n): Promise<RuntimeBootstrapState> {\n const mode = options.mode ?? 'local';\n const transport = host.resolveTransport(options.transport);\n const bindHost = options.bindHost ?? '127.0.0.1';\n const runtimeRoot = platform.resolvePath(options.runtimeRoot ?? platform.joinPath(platform.cwd(), '.test-data', 'xpod-runtime', id));\n const rootFilePath = platform.resolvePath(options.rootFilePath ?? platform.joinPath(runtimeRoot, 'data'));\n const sparqlEndpoint = normalizeDatabaseUrl(options.sparqlEndpoint ?? platform.joinPath(runtimeRoot, 'quadstore.sqlite'), platform);\n const rdfIndexPath = platform.resolvePath(options.rdfIndexPath ?? platform.joinPath(runtimeRoot, 'rdf-index.sqlite'));\n const identityDbUrl = normalizeDatabaseUrl(options.identityDbUrl ?? platform.joinPath(runtimeRoot, 'identity.sqlite'), platform);\n const usageDbUrl = normalizeDatabaseUrl(options.usageDbUrl ?? platform.joinPath(runtimeRoot, 'usage.sqlite'), platform);\n const cssAuthMode = options.authMode ?? (options.open ? 'allow-all' : 'acp');\n const apiOpen = options.apiOpen ?? options.open ?? false;\n const logLevel = options.logLevel ?? platform.getEnv('CSS_LOGGING_LEVEL') ?? 'warn';\n\n platform.ensureDir(runtimeRoot);\n platform.ensureDir(rootFilePath);\n\n const socketsRoot = platform.joinPath(runtimeRoot, 'sockets');\n if (transport === 'socket') {\n platform.ensureDir(socketsRoot);\n }\n const ports: XpodRuntimePorts = transport === 'port'\n ? await host.allocatePorts({\n gatewayPort: options.gatewayPort,\n cssPort: options.cssPort,\n apiPort: options.apiPort,\n basePort: 5600,\n })\n : {};\n const sockets: XpodRuntimeSockets = {};\n\n if (transport === 'socket') {\n sockets.gateway = platform.resolvePath(options.gatewaySocketPath ?? platform.joinPath(socketsRoot, 'gateway.sock'));\n sockets.css = platform.resolvePath(options.cssSocketPath ?? platform.joinPath(socketsRoot, 'css.sock'));\n sockets.api = platform.resolvePath(options.apiSocketPath ?? platform.joinPath(socketsRoot, 'api.sock'));\n }\n\n const baseUrl = ensureTrailingSlash(\n options.baseUrl ?? (transport === 'socket'\n ? 'http://localhost'\n : `http://${bindHost}:${ports.gateway}`),\n );\n\n return {\n id,\n host,\n mode,\n transport,\n bindHost,\n runtimeRoot,\n rootFilePath,\n sparqlEndpoint,\n rdfIndexPath,\n identityDbUrl,\n usageDbUrl,\n cssAuthMode,\n apiOpen,\n logLevel,\n baseUrl,\n envFilePath: options.envFile ? platform.resolvePath(options.envFile) : undefined,\n ports,\n sockets,\n };\n}\n\nexport function buildRuntimeEnv(\n state: RuntimeBootstrapState,\n options: XpodRuntimeOptions,\n envFromFile: Record<string, string | undefined> = {},\n): Record<string, string | undefined> {\n const mergedEnv = {\n ...envFromFile,\n ...options.env,\n };\n const externalOidcIssuer = resolveExternalOidcIssuer(mergedEnv);\n\n return {\n ...mergedEnv,\n XPOD_ENV_PATH: state.envFilePath,\n XPOD_EDITION: state.mode,\n CSS_BASE_URL: state.baseUrl,\n CSS_TOKEN_ENDPOINT: externalOidcIssuer\n ? oidcTokenEndpoint(externalOidcIssuer)\n : `${state.baseUrl}.oidc/token`,\n CSS_ROOT_FILE_PATH: state.rootFilePath,\n CSS_SPARQL_ENDPOINT: state.sparqlEndpoint,\n SPARQL_ENDPOINT: state.sparqlEndpoint,\n CSS_IDENTITY_DB_URL: state.identityDbUrl,\n DATABASE_URL: state.identityDbUrl,\n CSS_PORT: state.ports.css !== undefined ? String(state.ports.css) : undefined,\n API_PORT: state.ports.api !== undefined ? String(state.ports.api) : undefined,\n API_HOST: state.bindHost,\n API_SOCKET_PATH: state.sockets.api,\n XPOD_MAIN_PORT: state.ports.gateway !== undefined ? String(state.ports.gateway) : undefined,\n CORS_ORIGINS: new URL(state.baseUrl).origin,\n CSS_LOGGING_LEVEL: state.logLevel,\n };\n}\n\nexport function buildRuntimeShorthand(\n runtimeEnv: Record<string, string | undefined>,\n options: XpodRuntimeOptions,\n state: RuntimeBootstrapState,\n baseEnv: Record<string, string | undefined> = nodeRuntimePlatform.baseEnv,\n): Record<string, string | number | boolean> {\n const envValue = (key: string): string | undefined => runtimeEnv[key] ?? baseEnv[key];\n const externalOidcIssuer = resolveExternalOidcIssuer({\n oidcIssuer: envValue('oidcIssuer'),\n });\n\n return {\n ...withDefinedEntries([\n ['baseStorageDomain', envValue('CSS_BASE_STORAGE_DOMAIN')],\n ['minioAccessKey', envValue('CSS_MINIO_ACCESS_KEY')],\n ['minioSecretKey', envValue('CSS_MINIO_SECRET_KEY')],\n ['minioEndpoint', envValue('CSS_MINIO_ENDPOINT')],\n ['minioBucketName', envValue('CSS_MINIO_BUCKET_NAME')],\n ['redisClient', envValue('CSS_REDIS_CLIENT')],\n ['redisUsername', envValue('CSS_REDIS_USERNAME')],\n ['redisPassword', envValue('CSS_REDIS_PASSWORD')],\n ['emailConfigHost', envValue('CSS_EMAIL_CONFIG_HOST') ?? ''],\n ['emailConfigPort', envValue('CSS_EMAIL_CONFIG_PORT') ?? '587'],\n ['emailConfigAuthUser', envValue('CSS_EMAIL_CONFIG_AUTH_USER') ?? ''],\n ['emailConfigAuthPass', envValue('CSS_EMAIL_CONFIG_AUTH_PASS') ?? ''],\n ['oidcIssuer', externalOidcIssuer],\n ['allowedHosts', envValue('CSS_ALLOWED_HOSTS')],\n ['nodeId', envValue('XPOD_NODE_ID')],\n ['nodeToken', envValue('XPOD_NODE_TOKEN')],\n ['serviceToken', envValue('XPOD_SERVICE_TOKEN')],\n ]),\n baseUrl: state.baseUrl,\n rootFilePath: state.rootFilePath,\n sparqlEndpoint: state.sparqlEndpoint,\n rdfIndexPath: state.rdfIndexPath,\n identityDbUrl: state.identityDbUrl,\n usageDbUrl: state.usageDbUrl,\n logLevel: state.logLevel,\n authMode: state.cssAuthMode,\n edition: state.mode === 'cloud' ? 'server' : 'local',\n edgeNodesEnabled: options.edgeNodesEnabled ?? false,\n centerRegistrationEnabled: options.centerRegistrationEnabled ?? false,\n ...(options.shorthand ?? {}),\n };\n}\n\nexport function createCssRuntimeConfig(\n state: RuntimeBootstrapState,\n open: boolean,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'writeTextFile'> = nodeRuntimePlatform,\n): string {\n const configPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, `config/${state.mode}.json`));\n if (!open) {\n return configPath;\n }\n\n const runtimeRoot = normalizeWindowsAbsolutePath(state.runtimeRoot);\n const runtimeConfigPath = arePathsOnDifferentWindowsDrives(runtimeRoot, configPath)\n ? (() => {\n const runtimeConfigDir = normalizeWindowsAbsolutePath(platform.joinPath(\n platform.dirname(configPath),\n '..',\n '.xpod-runtime',\n state.id,\n ));\n platform.ensureDir(runtimeConfigDir);\n return normalizeWindowsAbsolutePath(platform.joinPath(runtimeConfigDir, 'css-runtime.config.json'));\n })()\n : normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));\n const openConfigPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, 'config/runtime-open.json'));\n platform.writeTextFile(runtimeConfigPath, JSON.stringify({\n '@context': [\n 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',\n ],\n import: [\n toConfigImportSpecifier(runtimeConfigPath, configPath),\n toConfigImportSpecifier(runtimeConfigPath, openConfigPath),\n ],\n }, null, 2));\n\n return runtimeConfigPath;\n}\n\nexport function initRuntimeLogger(\n level: string,\n platform: Pick<RuntimePlatform, 'cwd' | 'joinPath'> = nodeRuntimePlatform,\n): void {\n const loggerFactory = new ConfigurableLoggerFactory(level, {\n fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),\n showLocation: true,\n });\n setGlobalLoggerFactory(loggerFactory);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":";;;;;AAgHA,0DAoEC;AAED,0CAgCC;AAED,sDA4CC;A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AAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,sBAAsB,CAAC;QACnE,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,IAAA,8CAAsB,EAAC,aAAa,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { setGlobalLoggerFactory } from 'global-logger-factory';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { ConfigurableLoggerFactory } from '../logging/ConfigurableLoggerFactory';\nimport { PACKAGE_ROOT } from './package-root';\nimport type { RuntimeHost } from './host/types';\nimport { oidcTokenEndpoint, resolveExternalOidcIssuer } from './oidc-issuer';\nimport { nodeRuntimePlatform } from './platform/node/NodeRuntimePlatform';\nimport type { RuntimePlatform } from './platform/types';\nimport type { XpodRuntimeOptions, XpodRuntimePorts, XpodRuntimeSockets } from './runtime-types';\n\nexport interface RuntimeBootstrapState {\n id: string;\n host: RuntimeHost;\n mode: 'local' | 'cloud';\n transport: 'socket' | 'port';\n bindHost: string;\n runtimeRoot: string;\n rootFilePath: string;\n sparqlEndpoint: string;\n rdfIndexPath: string;\n identityDbUrl: string;\n usageDbUrl: string;\n cssAuthMode: 'acp' | 'acl' | 'allow-all';\n apiOpen: boolean;\n logLevel: string;\n baseUrl: string;\n envFilePath?: string;\n ports: XpodRuntimePorts;\n sockets: XpodRuntimeSockets;\n}\n\nfunction ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : `${url}/`;\n}\n\nfunction normalizeWindowsAbsolutePath(filePath: string): string {\n return filePath.replace(/^[\\\\/]+(?=[A-Za-z]:[\\\\/])/, '');\n}\n\nfunction isWindowsAbsolutePath(filePath: string): boolean {\n return /^[A-Za-z]:[\\\\/]/.test(normalizeWindowsAbsolutePath(filePath));\n}\n\nfunction getWindowsDriveRoot(filePath: string): string | undefined {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath);\n return isWindowsAbsolutePath(normalizedPath) ? path.win32.parse(normalizedPath).root.toLowerCase() : undefined;\n}\n\nfunction arePathsOnDifferentWindowsDrives(firstPath: string, secondPath: string): boolean {\n const firstRoot = getWindowsDriveRoot(firstPath);\n const secondRoot = getWindowsDriveRoot(secondPath);\n return Boolean(firstRoot && secondRoot && firstRoot !== secondRoot);\n}\n\nfunction toWindowsFileUrl(filePath: string): string {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath).replace(/\\\\/g, '/');\n return new URL(`file:///${normalizedPath}`).href;\n}\n\nfunction toConfigImportSpecifier(fromFilePath: string, toFilePath: string): string {\n const normalizedFromPath = normalizeWindowsAbsolutePath(fromFilePath);\n const normalizedToPath = normalizeWindowsAbsolutePath(toFilePath);\n if (!isWindowsAbsolutePath(normalizedFromPath) && (pathNeedsEscapedFileUrl(normalizedFromPath) || pathNeedsEscapedFileUrl(normalizedToPath))) {\n return pathToFileURL(normalizedToPath).href;\n }\n\n const useWindowsPaths = isWindowsAbsolutePath(normalizedFromPath) || isWindowsAbsolutePath(normalizedToPath);\n const pathApi = useWindowsPaths ? path.win32 : path.posix;\n const fromDirectoryPath = pathApi.dirname(useWindowsPaths ? normalizedFromPath : fromFilePath);\n const targetPath = useWindowsPaths ? normalizedToPath : toFilePath;\n\n if (useWindowsPaths && arePathsOnDifferentWindowsDrives(fromDirectoryPath, targetPath)) {\n return toWindowsFileUrl(targetPath);\n }\n\n const relativePath = pathApi.relative(fromDirectoryPath, targetPath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nfunction withDefinedEntries(entries: Array<[string, string | number | boolean | undefined]>): Record<string, string | number | boolean> {\n const result: Record<string, string | number | boolean> = {};\n for (const [key, value] of entries) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeDatabaseUrl(\n value: string,\n platform: Pick<RuntimePlatform, 'resolvePath'> = nodeRuntimePlatform,\n): string {\n if (\n value.startsWith('sqlite:') ||\n value.startsWith('postgres://') ||\n value.startsWith('postgresql://') ||\n value.startsWith('mysql://')\n ) {\n return value;\n }\n return `sqlite:${platform.resolvePath(value)}`;\n}\n\nexport async function resolveRuntimeBootstrap(\n id: string,\n options: XpodRuntimeOptions,\n host: RuntimeHost,\n platform: RuntimePlatform = nodeRuntimePlatform,\n): Promise<RuntimeBootstrapState> {\n const mode = options.mode ?? 'local';\n const transport = host.resolveTransport(options.transport);\n const bindHost = options.bindHost ?? '127.0.0.1';\n const runtimeRoot = platform.resolvePath(options.runtimeRoot ?? platform.joinPath(platform.cwd(), '.test-data', 'xpod-runtime', id));\n const rootFilePath = platform.resolvePath(options.rootFilePath ?? platform.joinPath(runtimeRoot, 'data'));\n const sparqlEndpoint = normalizeDatabaseUrl(options.sparqlEndpoint ?? platform.joinPath(runtimeRoot, 'quadstore.sqlite'), platform);\n const rdfIndexPath = platform.resolvePath(options.rdfIndexPath ?? platform.joinPath(runtimeRoot, 'rdf-index.sqlite'));\n const identityDbUrl = normalizeDatabaseUrl(options.identityDbUrl ?? platform.joinPath(runtimeRoot, 'identity.sqlite'), platform);\n const usageDbUrl = normalizeDatabaseUrl(options.usageDbUrl ?? platform.joinPath(runtimeRoot, 'usage.sqlite'), platform);\n const cssAuthMode = options.authMode ?? (options.open ? 'allow-all' : 'acp');\n const apiOpen = options.apiOpen ?? options.open ?? false;\n const logLevel = options.logLevel ?? platform.getEnv('CSS_LOGGING_LEVEL') ?? 'warn';\n\n platform.ensureDir(runtimeRoot);\n platform.ensureDir(rootFilePath);\n\n const socketsRoot = platform.joinPath(runtimeRoot, 'sockets');\n if (transport === 'socket') {\n platform.ensureDir(socketsRoot);\n }\n const ports: XpodRuntimePorts = transport === 'port'\n ? await host.allocatePorts({\n gatewayPort: options.gatewayPort,\n cssPort: options.cssPort,\n apiPort: options.apiPort,\n basePort: 5600,\n })\n : {};\n const sockets: XpodRuntimeSockets = {};\n\n if (transport === 'socket') {\n sockets.gateway = platform.resolvePath(options.gatewaySocketPath ?? platform.joinPath(socketsRoot, 'gateway.sock'));\n sockets.css = platform.resolvePath(options.cssSocketPath ?? platform.joinPath(socketsRoot, 'css.sock'));\n sockets.api = platform.resolvePath(options.apiSocketPath ?? platform.joinPath(socketsRoot, 'api.sock'));\n }\n\n const baseUrl = ensureTrailingSlash(\n options.baseUrl ?? (transport === 'socket'\n ? 'http://localhost'\n : `http://${bindHost}:${ports.gateway}`),\n );\n\n return {\n id,\n host,\n mode,\n transport,\n bindHost,\n runtimeRoot,\n rootFilePath,\n sparqlEndpoint,\n rdfIndexPath,\n identityDbUrl,\n usageDbUrl,\n cssAuthMode,\n apiOpen,\n logLevel,\n baseUrl,\n envFilePath: options.envFile ? platform.resolvePath(options.envFile) : undefined,\n ports,\n sockets,\n };\n}\n\nexport function buildRuntimeEnv(\n state: RuntimeBootstrapState,\n options: XpodRuntimeOptions,\n envFromFile: Record<string, string | undefined> = {},\n): Record<string, string | undefined> {\n const mergedEnv = {\n ...envFromFile,\n ...options.env,\n };\n const externalOidcIssuer = resolveExternalOidcIssuer(mergedEnv);\n\n return {\n ...mergedEnv,\n XPOD_ENV_PATH: state.envFilePath,\n XPOD_EDITION: state.mode,\n CSS_BASE_URL: state.baseUrl,\n CSS_TOKEN_ENDPOINT: externalOidcIssuer\n ? oidcTokenEndpoint(externalOidcIssuer)\n : `${state.baseUrl}.oidc/token`,\n CSS_ROOT_FILE_PATH: state.rootFilePath,\n CSS_SPARQL_ENDPOINT: state.sparqlEndpoint,\n SPARQL_ENDPOINT: state.sparqlEndpoint,\n CSS_IDENTITY_DB_URL: state.identityDbUrl,\n DATABASE_URL: state.identityDbUrl,\n CSS_PORT: state.ports.css !== undefined ? String(state.ports.css) : undefined,\n API_PORT: state.ports.api !== undefined ? String(state.ports.api) : undefined,\n API_HOST: state.bindHost,\n API_SOCKET_PATH: state.sockets.api,\n XPOD_MAIN_PORT: state.ports.gateway !== undefined ? String(state.ports.gateway) : undefined,\n CORS_ORIGINS: new URL(state.baseUrl).origin,\n CSS_LOGGING_LEVEL: state.logLevel,\n };\n}\n\nexport function buildRuntimeShorthand(\n runtimeEnv: Record<string, string | undefined>,\n options: XpodRuntimeOptions,\n state: RuntimeBootstrapState,\n baseEnv: Record<string, string | undefined> = nodeRuntimePlatform.baseEnv,\n): Record<string, string | number | boolean> {\n const envValue = (key: string): string | undefined => runtimeEnv[key] ?? baseEnv[key];\n const externalOidcIssuer = resolveExternalOidcIssuer({\n oidcIssuer: envValue('oidcIssuer'),\n });\n\n return {\n ...withDefinedEntries([\n ['baseStorageDomain', envValue('CSS_BASE_STORAGE_DOMAIN')],\n ['minioAccessKey', envValue('CSS_MINIO_ACCESS_KEY')],\n ['minioSecretKey', envValue('CSS_MINIO_SECRET_KEY')],\n ['minioEndpoint', envValue('CSS_MINIO_ENDPOINT')],\n ['minioBucketName', envValue('CSS_MINIO_BUCKET_NAME')],\n ['redisClient', envValue('CSS_REDIS_CLIENT')],\n ['redisUsername', envValue('CSS_REDIS_USERNAME')],\n ['redisPassword', envValue('CSS_REDIS_PASSWORD')],\n ['emailConfigHost', envValue('CSS_EMAIL_CONFIG_HOST') ?? ''],\n ['emailConfigPort', envValue('CSS_EMAIL_CONFIG_PORT') ?? '587'],\n ['emailConfigAuthUser', envValue('CSS_EMAIL_CONFIG_AUTH_USER') ?? ''],\n ['emailConfigAuthPass', envValue('CSS_EMAIL_CONFIG_AUTH_PASS') ?? ''],\n ['oidcIssuer', externalOidcIssuer],\n ['allowedHosts', envValue('CSS_ALLOWED_HOSTS')],\n ['nodeId', envValue('XPOD_NODE_ID')],\n ['nodeToken', envValue('XPOD_NODE_TOKEN')],\n ['serviceToken', envValue('XPOD_SERVICE_TOKEN')],\n ]),\n baseUrl: state.baseUrl,\n rootFilePath: state.rootFilePath,\n sparqlEndpoint: state.sparqlEndpoint,\n rdfIndexPath: state.rdfIndexPath,\n identityDbUrl: state.identityDbUrl,\n usageDbUrl: state.usageDbUrl,\n logLevel: state.logLevel,\n authMode: state.cssAuthMode,\n edition: state.mode === 'cloud' ? 'server' : 'local',\n edgeNodesEnabled: options.edgeNodesEnabled ?? false,\n centerRegistrationEnabled: options.centerRegistrationEnabled ?? false,\n ...(options.shorthand ?? {}),\n };\n}\n\nexport function createCssRuntimeConfig(\n state: RuntimeBootstrapState,\n open: boolean,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'> = nodeRuntimePlatform,\n): string {\n const configPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, `config/${state.mode}.json`));\n if (!open) {\n return configPath;\n }\n\n const runtimeRoot = normalizeWindowsAbsolutePath(state.runtimeRoot);\n const runtimeConfigPath = arePathsOnDifferentWindowsDrives(runtimeRoot, configPath)\n ? (() => {\n const runtimeConfigDir = normalizeWindowsAbsolutePath(platform.joinPath(\n platform.dirname(configPath),\n '..',\n '.xpod-runtime',\n state.id,\n ));\n platform.ensureDir(runtimeConfigDir);\n return normalizeWindowsAbsolutePath(platform.joinPath(runtimeConfigDir, 'css-runtime.config.json'));\n })()\n : normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));\n const openConfigPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, 'config/runtime-open.json'));\n const runtimeConfigDir = platform.dirname(runtimeConfigPath);\n const runtimeConfigImportPath = rewriteConfigForFileUrlImportsIfNeeded(\n configPath,\n platform.joinPath(runtimeConfigDir, 'config'),\n platform,\n );\n platform.writeTextFile(runtimeConfigPath, JSON.stringify({\n '@context': [\n 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',\n ],\n import: [\n toConfigImportSpecifier(runtimeConfigPath, runtimeConfigImportPath),\n toConfigImportSpecifier(runtimeConfigPath, openConfigPath),\n ],\n }, null, 2));\n\n return runtimeConfigPath;\n}\n\nfunction rewriteConfigForFileUrlImportsIfNeeded(\n configPath: string,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten = new Map<string, string>(),\n): string {\n const normalizedConfigPath = normalizeWindowsAbsolutePath(configPath);\n if (isWindowsAbsolutePath(normalizedConfigPath) || !pathNeedsEscapedFileUrl(normalizedConfigPath)) {\n return normalizedConfigPath;\n }\n\n const existing = rewritten.get(normalizedConfigPath);\n if (existing) {\n return existing;\n }\n\n platform.ensureDir(outputDir);\n const outputPath = normalizeWindowsAbsolutePath(platform.joinPath(outputDir, path.posix.basename(normalizedConfigPath)));\n rewritten.set(normalizedConfigPath, outputPath);\n\n const parsed = JSON.parse(platform.readTextFile(normalizedConfigPath)) as Record<string, unknown>;\n parsed.import = rewriteConfigImports(\n normalizedConfigPath,\n parsed.import,\n outputDir,\n platform,\n rewritten,\n );\n platform.writeTextFile(outputPath, `${JSON.stringify(parsed, null, 2)}\\n`);\n return outputPath;\n}\n\nfunction rewriteConfigImports(\n sourceConfigPath: string,\n imports: unknown,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten: Map<string, string>,\n): unknown {\n if (typeof imports === 'string') {\n return rewriteConfigImport(sourceConfigPath, imports, outputDir, platform, rewritten);\n }\n\n if (Array.isArray(imports)) {\n return imports.map((value) => typeof value === 'string'\n ? rewriteConfigImport(sourceConfigPath, value, outputDir, platform, rewritten)\n : value);\n }\n\n return imports;\n}\n\nfunction rewriteConfigImport(\n sourceConfigPath: string,\n importValue: string,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten: Map<string, string>,\n): string {\n if (!importValue.startsWith('./') && !importValue.startsWith('../')) {\n return importValue;\n }\n\n const targetPath = normalizeWindowsAbsolutePath(\n path.posix.resolve(platform.dirname(sourceConfigPath), importValue),\n );\n const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, platform, rewritten);\n return pathToFileURL(rewrittenTargetPath).href;\n}\n\nexport function initRuntimeLogger(\n level: string,\n platform: Pick<RuntimePlatform, 'cwd' | 'joinPath'> = nodeRuntimePlatform,\n): void {\n const loggerFactory = new ConfigurableLoggerFactory(level, {\n fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),\n showLocation: true,\n });\n setGlobalLoggerFactory(loggerFactory);\n}\n"]}
|
|
@@ -56,6 +56,7 @@ function pathNeedsEscapedFileUrl(filePath) {
|
|
|
56
56
|
function createCssChildRuntimeConfig(options) {
|
|
57
57
|
node_fs_1.default.mkdirSync(options.runtimeRoot, { recursive: true });
|
|
58
58
|
const runtimeConfigPath = node_path_1.default.join(options.runtimeRoot, 'css-child-runtime.config.json');
|
|
59
|
+
const configImportPath = rewriteConfigForFileUrlImportsIfNeeded(node_path_1.default.resolve(options.configPath), node_path_1.default.join(options.runtimeRoot, 'config'));
|
|
59
60
|
node_fs_1.default.writeFileSync(runtimeConfigPath, JSON.stringify({
|
|
60
61
|
'@context': [
|
|
61
62
|
'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',
|
|
@@ -63,7 +64,7 @@ function createCssChildRuntimeConfig(options) {
|
|
|
63
64
|
'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',
|
|
64
65
|
],
|
|
65
66
|
import: [
|
|
66
|
-
toImportSpecifier(runtimeConfigPath,
|
|
67
|
+
toImportSpecifier(runtimeConfigPath, configImportPath),
|
|
67
68
|
],
|
|
68
69
|
'@graph': [],
|
|
69
70
|
}, null, 2), 'utf-8');
|
|
@@ -81,6 +82,41 @@ function createCssChildRuntimeConfig(options) {
|
|
|
81
82
|
cwd: options.externalOidcIssuer ? options.runtimeRoot : undefined,
|
|
82
83
|
};
|
|
83
84
|
}
|
|
85
|
+
function rewriteConfigForFileUrlImportsIfNeeded(configPath, outputDir, rewritten = new Map()) {
|
|
86
|
+
if (!pathNeedsEscapedFileUrl(configPath)) {
|
|
87
|
+
return configPath;
|
|
88
|
+
}
|
|
89
|
+
const existing = rewritten.get(configPath);
|
|
90
|
+
if (existing) {
|
|
91
|
+
return existing;
|
|
92
|
+
}
|
|
93
|
+
node_fs_1.default.mkdirSync(outputDir, { recursive: true });
|
|
94
|
+
const outputPath = node_path_1.default.join(outputDir, node_path_1.default.basename(configPath));
|
|
95
|
+
rewritten.set(configPath, outputPath);
|
|
96
|
+
const parsed = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));
|
|
97
|
+
parsed.import = rewriteConfigImports(configPath, parsed.import, outputDir, rewritten);
|
|
98
|
+
node_fs_1.default.writeFileSync(outputPath, `${JSON.stringify(parsed, null, 2)}\n`, 'utf-8');
|
|
99
|
+
return outputPath;
|
|
100
|
+
}
|
|
101
|
+
function rewriteConfigImports(sourceConfigPath, imports, outputDir, rewritten) {
|
|
102
|
+
if (typeof imports === 'string') {
|
|
103
|
+
return rewriteConfigImport(sourceConfigPath, imports, outputDir, rewritten);
|
|
104
|
+
}
|
|
105
|
+
if (Array.isArray(imports)) {
|
|
106
|
+
return imports.map((value) => typeof value === 'string'
|
|
107
|
+
? rewriteConfigImport(sourceConfigPath, value, outputDir, rewritten)
|
|
108
|
+
: value);
|
|
109
|
+
}
|
|
110
|
+
return imports;
|
|
111
|
+
}
|
|
112
|
+
function rewriteConfigImport(sourceConfigPath, importValue, outputDir, rewritten) {
|
|
113
|
+
if (!importValue.startsWith('./') && !importValue.startsWith('../')) {
|
|
114
|
+
return importValue;
|
|
115
|
+
}
|
|
116
|
+
const targetPath = node_path_1.default.resolve(node_path_1.default.dirname(sourceConfigPath), importValue);
|
|
117
|
+
const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, rewritten);
|
|
118
|
+
return (0, node_url_1.pathToFileURL)(rewrittenTargetPath).href;
|
|
119
|
+
}
|
|
84
120
|
function buildCssArgs(options) {
|
|
85
121
|
return [
|
|
86
122
|
options.cssBinary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-process.js","sourceRoot":"","sources":["../../src/runtime/css-process.ts"],"names":[],"mappings":";;;;;AAYA,4CAmBC;AA4BD,kEAiCC;AAED,oCAeC;AAED,4CAmBC;AAlID,sDAAyB;AACzB,0DAA6B;AAC7B,uCAAyC;AACzC,+CAAkD;AAElD;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,OAAe,EACf,OAAe,EACf,UAAmB,EACnB,UAA6B,OAAO,CAAC,GAAG;IAExC,MAAM,GAAG,GAA2B;QAClC,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;QAC5B,YAAY,EAAE,OAAO;KACI,CAAC;IAE5B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,GAAG,KAAK,YAAY,IAAI,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAC7C,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC/D,OAAO,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACtC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7B,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAC1C,UAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,iBAAiB,CAAC,YAAoB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C3C,gBAAgB,EAAE,oBAAoB,OAAO,CAAC,OAAO,EAAE;QACvD,YAAY,EAAE,OAAO,CAAC,OAAO;QAC7B,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;YAC5C,CAAC,CAAC,IAAA,+BAAiB,EAAC,OAAO,CAAC,kBAAkB,CAAC;YAC/C,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,aAAa;KACV,CAAC;AAC9B,CAAC","sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { oidcTokenEndpoint } from './oidc-issuer';\n\n/**\n * Build the environment for the CSS child process.\n *\n * `oidcIssuer` is an xpod shorthand value, not a CSS CLI argument.\n * The legacy CSS child process path injects it through a generated\n * Components.js config instead of CSS_* env aliases.\n */\nexport function buildCssChildEnv(\n baseUrl: string,\n cssPort: number,\n oidcIssuer?: string,\n baseEnv: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n const env: Record<string, string> = {\n ...baseEnv,\n CSS_PORT: cssPort.toString(),\n CSS_BASE_URL: baseUrl,\n } as Record<string, string>;\n\n for (const key of Object.keys(env)) {\n if (key === 'oidcIssuer' || isExternalOidcPollutionKey(key)) {\n delete env[key];\n }\n }\n\n return env;\n}\n\nfunction isExternalOidcPollutionKey(key: string): boolean {\n const normalized = key.toUpperCase().replace(/[^A-Z0-9]/g, '');\n return normalized.includes('OIDCISSUER') ||\n normalized.includes('IDPURL') ||\n normalized.includes('IDPJWKSURL') ||\n normalized.includes('IDENTITYPROVIDERURL') ||\n normalized.includes('IDENTITYPROVIDERJWKSURL');\n}\n\nfunction toImportSpecifier(fromFilePath: string, toFilePath: string): string {\n if (pathNeedsEscapedFileUrl(fromFilePath) || pathNeedsEscapedFileUrl(toFilePath)) {\n return pathToFileURL(toFilePath).href;\n }\n\n const fromDirectory = path.dirname(fromFilePath);\n const relativePath = path.relative(fromDirectory, toFilePath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nexport function createCssChildRuntimeConfig(options: {\n configPath: string\n runtimeRoot: string\n externalOidcIssuer?: string\n}): { configPath: string; cwd?: string } {\n fs.mkdirSync(options.runtimeRoot, { recursive: true });\n const runtimeConfigPath = path.join(options.runtimeRoot, 'css-child-runtime.config.json');\n fs.writeFileSync(runtimeConfigPath, JSON.stringify({\n '@context': [\n 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',\n ],\n import: [\n toImportSpecifier(runtimeConfigPath, options.configPath),\n ],\n '@graph': [],\n }, null, 2), 'utf-8');\n\n if (options.externalOidcIssuer) {\n fs.writeFileSync(path.join(options.runtimeRoot, 'package.json'), JSON.stringify({\n private: true,\n name: 'xpod-css-runtime',\n }, null, 2), 'utf-8');\n fs.writeFileSync(path.join(options.runtimeRoot, '.community-solid-server.config.json'), JSON.stringify({\n oidcIssuer: options.externalOidcIssuer,\n }, null, 2), 'utf-8');\n }\n\n return {\n configPath: runtimeConfigPath,\n cwd: options.externalOidcIssuer ? options.runtimeRoot : undefined,\n };\n}\n\nexport function buildCssArgs(options: {\n cssBinary: string\n configPath: string\n cssModuleRoot: string\n cssPort: number\n baseUrl: string\n externalOidcIssuer?: string\n}): string[] {\n return [\n options.cssBinary,\n '-c', options.configPath,\n '-m', options.cssModuleRoot,\n '-p', options.cssPort.toString(),\n '-b', options.baseUrl,\n ];\n}\n\nexport function buildApiChildEnv(options: {\n apiPort: number\n mainPort: number\n cssPort: number\n baseUrl: string\n externalOidcIssuer?: string\n baseEnv?: NodeJS.ProcessEnv\n}): Record<string, string> {\n return {\n ...(options.baseEnv ?? process.env),\n ...(options.externalOidcIssuer ? { oidcIssuer: options.externalOidcIssuer } : {}),\n API_PORT: options.apiPort.toString(),\n XPOD_MAIN_PORT: options.mainPort.toString(),\n CSS_INTERNAL_URL: `http://localhost:${options.cssPort}`,\n CSS_BASE_URL: options.baseUrl,\n CSS_TOKEN_ENDPOINT: options.externalOidcIssuer\n ? oidcTokenEndpoint(options.externalOidcIssuer)\n : `${options.baseUrl}.oidc/token`,\n } as Record<string, string>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"css-process.js","sourceRoot":"","sources":["../../src/runtime/css-process.ts"],"names":[],"mappings":";;;;;AAYA,4CAmBC;AA4BD,kEAqCC;AA6DD,oCAeC;AAED,4CAmBC;AAjMD,sDAAyB;AACzB,0DAA6B;AAC7B,uCAAyC;AACzC,+CAAkD;AAElD;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,OAAe,EACf,OAAe,EACf,UAAmB,EACnB,UAA6B,OAAO,CAAC,GAAG;IAExC,MAAM,GAAG,GAA2B;QAClC,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;QAC5B,YAAY,EAAE,OAAO;KACI,CAAC;IAE5B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,GAAG,KAAK,YAAY,IAAI,0BAA0B,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAC7C,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC/D,OAAO,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;QACtC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7B,UAAU,CAAC,QAAQ,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CAAC,IAAA,+BAAiB,EAAC,OAAO,CAAC,kBAAkB,CAAC;YAC/C,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,aAAa;KACV,CAAC;AAC9B,CAAC","sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { oidcTokenEndpoint } from './oidc-issuer';\n\n/**\n * Build the environment for the CSS child process.\n *\n * `oidcIssuer` is an xpod shorthand value, not a CSS CLI argument.\n * The legacy CSS child process path injects it through a generated\n * Components.js config instead of CSS_* env aliases.\n */\nexport function buildCssChildEnv(\n baseUrl: string,\n cssPort: number,\n oidcIssuer?: string,\n baseEnv: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n const env: Record<string, string> = {\n ...baseEnv,\n CSS_PORT: cssPort.toString(),\n CSS_BASE_URL: baseUrl,\n } as Record<string, string>;\n\n for (const key of Object.keys(env)) {\n if (key === 'oidcIssuer' || isExternalOidcPollutionKey(key)) {\n delete env[key];\n }\n }\n\n return env;\n}\n\nfunction isExternalOidcPollutionKey(key: string): boolean {\n const normalized = key.toUpperCase().replace(/[^A-Z0-9]/g, '');\n return normalized.includes('OIDCISSUER') ||\n normalized.includes('IDPURL') ||\n normalized.includes('IDPJWKSURL') ||\n normalized.includes('IDENTITYPROVIDERURL') ||\n normalized.includes('IDENTITYPROVIDERJWKSURL');\n}\n\nfunction toImportSpecifier(fromFilePath: string, toFilePath: string): string {\n if (pathNeedsEscapedFileUrl(fromFilePath) || pathNeedsEscapedFileUrl(toFilePath)) {\n return pathToFileURL(toFilePath).href;\n }\n\n const fromDirectory = path.dirname(fromFilePath);\n const relativePath = path.relative(fromDirectory, toFilePath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nexport function createCssChildRuntimeConfig(options: {\n configPath: string\n runtimeRoot: string\n externalOidcIssuer?: string\n}): { configPath: string; cwd?: string } {\n fs.mkdirSync(options.runtimeRoot, { recursive: true });\n const runtimeConfigPath = path.join(options.runtimeRoot, 'css-child-runtime.config.json');\n const configImportPath = rewriteConfigForFileUrlImportsIfNeeded(\n path.resolve(options.configPath),\n path.join(options.runtimeRoot, 'config'),\n );\n fs.writeFileSync(runtimeConfigPath, JSON.stringify({\n '@context': [\n 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',\n ],\n import: [\n toImportSpecifier(runtimeConfigPath, configImportPath),\n ],\n '@graph': [],\n }, null, 2), 'utf-8');\n\n if (options.externalOidcIssuer) {\n fs.writeFileSync(path.join(options.runtimeRoot, 'package.json'), JSON.stringify({\n private: true,\n name: 'xpod-css-runtime',\n }, null, 2), 'utf-8');\n fs.writeFileSync(path.join(options.runtimeRoot, '.community-solid-server.config.json'), JSON.stringify({\n oidcIssuer: options.externalOidcIssuer,\n }, null, 2), 'utf-8');\n }\n\n return {\n configPath: runtimeConfigPath,\n cwd: options.externalOidcIssuer ? options.runtimeRoot : undefined,\n };\n}\n\nfunction rewriteConfigForFileUrlImportsIfNeeded(\n configPath: string,\n outputDir: string,\n rewritten = new Map<string, string>(),\n): string {\n if (!pathNeedsEscapedFileUrl(configPath)) {\n return configPath;\n }\n\n const existing = rewritten.get(configPath);\n if (existing) {\n return existing;\n }\n\n fs.mkdirSync(outputDir, { recursive: true });\n const outputPath = path.join(outputDir, path.basename(configPath));\n rewritten.set(configPath, outputPath);\n\n const parsed = JSON.parse(fs.readFileSync(configPath, 'utf-8')) as Record<string, unknown>;\n parsed.import = rewriteConfigImports(configPath, parsed.import, outputDir, rewritten);\n fs.writeFileSync(outputPath, `${JSON.stringify(parsed, null, 2)}\\n`, 'utf-8');\n\n return outputPath;\n}\n\nfunction rewriteConfigImports(\n sourceConfigPath: string,\n imports: unknown,\n outputDir: string,\n rewritten: Map<string, string>,\n): unknown {\n if (typeof imports === 'string') {\n return rewriteConfigImport(sourceConfigPath, imports, outputDir, rewritten);\n }\n\n if (Array.isArray(imports)) {\n return imports.map((value) => typeof value === 'string'\n ? rewriteConfigImport(sourceConfigPath, value, outputDir, rewritten)\n : value);\n }\n\n return imports;\n}\n\nfunction rewriteConfigImport(\n sourceConfigPath: string,\n importValue: string,\n outputDir: string,\n rewritten: Map<string, string>,\n): string {\n if (!importValue.startsWith('./') && !importValue.startsWith('../')) {\n return importValue;\n }\n\n const targetPath = path.resolve(path.dirname(sourceConfigPath), importValue);\n const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, rewritten);\n return pathToFileURL(rewrittenTargetPath).href;\n}\n\nexport function buildCssArgs(options: {\n cssBinary: string\n configPath: string\n cssModuleRoot: string\n cssPort: number\n baseUrl: string\n externalOidcIssuer?: string\n}): string[] {\n return [\n options.cssBinary,\n '-c', options.configPath,\n '-m', options.cssModuleRoot,\n '-p', options.cssPort.toString(),\n '-b', options.baseUrl,\n ];\n}\n\nexport function buildApiChildEnv(options: {\n apiPort: number\n mainPort: number\n cssPort: number\n baseUrl: string\n externalOidcIssuer?: string\n baseEnv?: NodeJS.ProcessEnv\n}): Record<string, string> {\n return {\n ...(options.baseEnv ?? process.env),\n ...(options.externalOidcIssuer ? { oidcIssuer: options.externalOidcIssuer } : {}),\n API_PORT: options.apiPort.toString(),\n XPOD_MAIN_PORT: options.mainPort.toString(),\n CSS_INTERNAL_URL: `http://localhost:${options.cssPort}`,\n CSS_BASE_URL: options.baseUrl,\n CSS_TOKEN_ENDPOINT: options.externalOidcIssuer\n ? oidcTokenEndpoint(options.externalOidcIssuer)\n : `${options.baseUrl}.oidc/token`,\n } as Record<string, string>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undefineds.co/xpod",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"description": "Xpod is an extended Community Solid Server, offering rich-feature, production-level Solid Pod and identity management.",
|
|
5
5
|
"repository": "https://github.com/undefinedsco/xpod",
|
|
6
6
|
"author": "developer@undefineds.co",
|