@zlooks.cn/sitemap-server 1.0.1

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.
Files changed (45) hide show
  1. package/dist/command/index.d.ts +3 -0
  2. package/dist/command/index.d.ts.map +1 -0
  3. package/dist/command/index.js +12 -0
  4. package/dist/command/index.js.map +1 -0
  5. package/dist/config/schema.d.ts +9 -0
  6. package/dist/config/schema.d.ts.map +1 -0
  7. package/dist/config/schema.js +6 -0
  8. package/dist/config/schema.js.map +1 -0
  9. package/dist/messages/sitemap/read.msg.d.ts +3 -0
  10. package/dist/messages/sitemap/read.msg.d.ts.map +1 -0
  11. package/dist/messages/sitemap/read.msg.js +10 -0
  12. package/dist/messages/sitemap/read.msg.js.map +1 -0
  13. package/dist/models/read-sitemap.model.d.ts +8 -0
  14. package/dist/models/read-sitemap.model.d.ts.map +1 -0
  15. package/dist/models/read-sitemap.model.js +11 -0
  16. package/dist/models/read-sitemap.model.js.map +1 -0
  17. package/dist/services/application.service.d.ts +4 -0
  18. package/dist/services/application.service.d.ts.map +1 -0
  19. package/dist/services/application.service.js +22 -0
  20. package/dist/services/application.service.js.map +1 -0
  21. package/dist/services/config.service.d.ts +3 -0
  22. package/dist/services/config.service.d.ts.map +1 -0
  23. package/dist/services/config.service.js +20 -0
  24. package/dist/services/config.service.js.map +1 -0
  25. package/dist/services/logger.service.d.ts +4 -0
  26. package/dist/services/logger.service.d.ts.map +1 -0
  27. package/dist/services/logger.service.js +8 -0
  28. package/dist/services/logger.service.js.map +1 -0
  29. package/dist/services/sitemap-runtime.service.d.ts +4 -0
  30. package/dist/services/sitemap-runtime.service.d.ts.map +1 -0
  31. package/dist/services/sitemap-runtime.service.js +29 -0
  32. package/dist/services/sitemap-runtime.service.js.map +1 -0
  33. package/dist/services/sitemap.boot.d.ts +3 -0
  34. package/dist/services/sitemap.boot.d.ts.map +1 -0
  35. package/dist/services/sitemap.boot.js +4 -0
  36. package/dist/services/sitemap.boot.js.map +1 -0
  37. package/dist/sitemap/sitemap-aggregator.d.ts +40 -0
  38. package/dist/sitemap/sitemap-aggregator.d.ts.map +1 -0
  39. package/dist/sitemap/sitemap-aggregator.js +241 -0
  40. package/dist/sitemap/sitemap-aggregator.js.map +1 -0
  41. package/dist/sitemap/sitemap-document.d.ts +3 -0
  42. package/dist/sitemap/sitemap-document.d.ts.map +1 -0
  43. package/dist/sitemap/sitemap-document.js +56 -0
  44. package/dist/sitemap/sitemap-document.js.map +1 -0
  45. package/package.json +49 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { runServiceCommand } from '@zlooks.cn/service-command';
4
+ await runServiceCommand({
5
+ packageRoot: fileURLToPath(new URL('../../', import.meta.url)),
6
+ requiresReactServer: false,
7
+ }).catch(reportStartupFailure);
8
+ function reportStartupFailure(error) {
9
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
10
+ process.exitCode = 1;
11
+ }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,iBAAiB,CAAC;IACtB,WAAW,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9D,mBAAmB,EAAE,KAAK;CAC3B,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAE/B,SAAS,oBAAoB,CAAC,KAAc;IAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface SitemapServerConfig {
2
+ readonly public: {
3
+ readonly origin: string;
4
+ };
5
+ }
6
+ export declare function parseSitemapServerConfig(input: {
7
+ readonly publicHost: unknown;
8
+ }): SitemapServerConfig;
9
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,mBAAmB,CAGrG"}
@@ -0,0 +1,6 @@
1
+ import { parsePublicHostConfig } from '@zlooks.cn/public-host-contract';
2
+ export function parseSitemapServerConfig(input) {
3
+ const publicHost = parsePublicHostConfig(input.publicHost);
4
+ return Object.freeze({ public: Object.freeze({ origin: publicHost.origin }) });
5
+ }
6
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAMxE,MAAM,UAAU,wBAAwB,CAAC,KAAuC;IAC9E,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@hile/message-loader").MessageRegisterProps<unknown, import("@hile/micro").MicroMessageHandlerExtras>;
2
+ export default _default;
3
+ //# sourceMappingURL=read.msg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.msg.d.ts","sourceRoot":"","sources":["../../../src/messages/sitemap/read.msg.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { defineMicroMessage } from '@hile/micro';
2
+ import { loadModel } from '@hile/model';
3
+ import { parseSitemapReadRequest } from '@zlooks.cn/sitemap-contract';
4
+ import readSitemapModel from '../../models/read-sitemap.model.js';
5
+ export default defineMicroMessage(async ({ data, invocation }) => {
6
+ invocation.signal.throwIfAborted();
7
+ const request = parseSitemapReadRequest(data);
8
+ return loadModel(readSitemapModel, request, invocation);
9
+ });
10
+ //# sourceMappingURL=read.msg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.msg.js","sourceRoot":"","sources":["../../../src/messages/sitemap/read.msg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAElE,eAAe,kBAAkB,CAAU,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IACxE,UAAU,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,SAAS,CAAC,gBAAgB,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const _default: import("@hile/model").ModelDefinition<Readonly<Record<string, never>>, Readonly<{
2
+ xml: string;
3
+ etag: string;
4
+ lastModified: string | null;
5
+ entryCount: number;
6
+ }>>;
7
+ export default _default;
8
+ //# sourceMappingURL=read-sitemap.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-sitemap.model.d.ts","sourceRoot":"","sources":["../../src/models/read-sitemap.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { defineModel } from '@hile/model';
2
+ import { parseSitemapReadResponse } from '@zlooks.cn/sitemap-contract';
3
+ import sitemapRuntimeService from '../services/sitemap-runtime.service.js';
4
+ export default defineModel({
5
+ services: [sitemapRuntimeService],
6
+ async main([sitemap], _input, invocation) {
7
+ invocation.signal.throwIfAborted();
8
+ return parseSitemapReadResponse(sitemap.read());
9
+ },
10
+ });
11
+ //# sourceMappingURL=read-sitemap.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-sitemap.model.js","sourceRoot":"","sources":["../../src/models/read-sitemap.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAA4B,MAAM,6BAA6B,CAAC;AACjG,OAAO,qBAAqB,MAAM,wCAAwC,CAAC;AAE3E,eAAe,WAAW,CAAC;IACzB,QAAQ,EAAE,CAAC,qBAAqB,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,MAAuC,EAAE,UAAU;QACvE,UAAU,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACnC,OAAO,wBAAwB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Application } from '@hile/micro';
2
+ declare const _default: import("@hile/core").ServiceRegisterProps<Application>;
3
+ export default _default;
4
+ //# sourceMappingURL=application.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.service.d.ts","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { defineService } from '@hile/core';
2
+ import { Application } from '@hile/micro';
3
+ import { SITEMAP_SERVICE_NAMESPACE } from '@zlooks.cn/sitemap-contract';
4
+ import { parseAdvertiseHost, parseRegistryBootstrap } from '@zlooks.cn/registry-config';
5
+ import { detect } from 'detect-port';
6
+ export default defineService('zlooks.sitemap.application', async (shutdown) => {
7
+ const registry = parseRegistryBootstrap({
8
+ REGISTRY_HOST: process.env.REGISTRY_HOST,
9
+ REGISTRY_PORT: process.env.REGISTRY_PORT,
10
+ });
11
+ const advertiseHost = parseAdvertiseHost(process.env.HILE_ADVERTISE_HOST);
12
+ const application = new Application({
13
+ namespace: SITEMAP_SERVICE_NAMESPACE,
14
+ registry,
15
+ ...(advertiseHost ? { advertiseHost } : {}),
16
+ });
17
+ await application.load(new URL('../messages', import.meta.url).pathname);
18
+ const microPort = await detect();
19
+ shutdown(await application.listen(microPort));
20
+ return application;
21
+ });
22
+ //# sourceMappingURL=application.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.service.js","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAe,aAAa,CAAC,4BAA4B,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC5E,MAAM,QAAQ,GAAG,sBAAsB,CAAC;QACtC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;QACxC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;KACzC,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,SAAS,EAAE,yBAAyB;QACpC,QAAQ;QACR,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC,CAAC;IACH,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,MAAM,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@hile/core").ServiceRegisterProps<import("@zlooks.cn/registry-config").RegistryConfigSubscription<import("../config/schema.js").SitemapServerConfig>>;
2
+ export default _default;
3
+ //# sourceMappingURL=config.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.service.d.ts","sourceRoot":"","sources":["../../src/services/config.service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { defineService, loadService } from '@hile/core';
2
+ import { PUBLIC_HOST_CONFIG_TOPIC_KEY, parsePublicHostConfig, } from '@zlooks.cn/public-host-contract';
3
+ import { registryConfigTopic, subscribeRegistryConfig } from '@zlooks.cn/registry-config';
4
+ import { parseSitemapServerConfig } from '../config/schema.js';
5
+ import applicationService from './application.service.js';
6
+ export default defineService('zlooks.sitemap.config', async (shutdown) => {
7
+ const application = await loadService(applicationService);
8
+ const subscriber = await subscribeRegistryConfig(application, {
9
+ sources: {
10
+ publicHost: {
11
+ topic: registryConfigTopic(PUBLIC_HOST_CONFIG_TOPIC_KEY),
12
+ parse: parsePublicHostConfig,
13
+ },
14
+ },
15
+ compose: parseSitemapServerConfig,
16
+ });
17
+ shutdown(() => subscriber.close());
18
+ return subscriber;
19
+ });
20
+ //# sourceMappingURL=config.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../src/services/config.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D,eAAe,aAAa,CAAC,uBAAuB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IACvE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,uBAAuB,CAAC,WAAW,EAAE;QAC5D,OAAO,EAAE;YACP,UAAU,EAAE;gBACV,KAAK,EAAE,mBAAmB,CAAC,4BAA4B,CAAC;gBACxD,KAAK,EAAE,qBAAqB;aAC7B;SACF;QACD,OAAO,EAAE,wBAAwB;KAClC,CAAC,CAAC;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Logger } from '@hile/logger';
2
+ declare const _default: import("@hile/core").ServiceRegisterProps<Logger>;
3
+ export default _default;
4
+ //# sourceMappingURL=logger.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.service.d.ts","sourceRoot":"","sources":["../../src/services/logger.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { defineService } from '@hile/core';
2
+ import { createLogger } from '@hile/logger';
3
+ export default defineService('zlooks.sitemap.logger', async (shutdown) => {
4
+ const { logger, teardown } = createLogger({ level: 'info', pretty: false });
5
+ shutdown(teardown);
6
+ return logger;
7
+ });
8
+ //# sourceMappingURL=logger.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../src/services/logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAEzD,eAAe,aAAa,CAAC,uBAAuB,EAAE,KAAK,EAAE,QAAQ,EAAmB,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { SitemapAggregator } from '../sitemap/sitemap-aggregator.js';
2
+ declare const _default: import("@hile/core").ServiceRegisterProps<SitemapAggregator>;
3
+ export default _default;
4
+ //# sourceMappingURL=sitemap-runtime.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-runtime.service.d.ts","sourceRoot":"","sources":["../../src/services/sitemap-runtime.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { defineService, loadService } from '@hile/core';
2
+ import { SitemapAggregator } from '../sitemap/sitemap-aggregator.js';
3
+ import applicationService from './application.service.js';
4
+ import configService from './config.service.js';
5
+ import loggerService from './logger.service.js';
6
+ export default defineService('zlooks.sitemap.runtime', async (shutdown) => {
7
+ const [application, config, logger] = await Promise.all([
8
+ loadService(applicationService),
9
+ loadService(configService),
10
+ loadService(loggerService),
11
+ ]);
12
+ const aggregator = new SitemapAggregator({
13
+ application,
14
+ readOrigin: () => config.snapshot().public.origin,
15
+ onProviderError: (providerId, error) => logger.warn({
16
+ err: error,
17
+ providerId,
18
+ event: 'sitemap.provider-refresh.failed',
19
+ }, 'Sitemap Provider refresh failed'),
20
+ onError: (error) => logger.error({
21
+ err: error,
22
+ event: 'sitemap.refresh.failed',
23
+ }, 'Sitemap refresh failed'),
24
+ });
25
+ shutdown(() => aggregator.close());
26
+ await aggregator.start();
27
+ return aggregator;
28
+ });
29
+ //# sourceMappingURL=sitemap-runtime.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-runtime.service.js","sourceRoot":"","sources":["../../src/services/sitemap-runtime.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,eAAe,aAAa,CAAC,wBAAwB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IACxE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtD,WAAW,CAAC,kBAAkB,CAAC;QAC/B,WAAW,CAAC,aAAa,CAAC;QAC1B,WAAW,CAAC,aAAa,CAAC;KAC3B,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC;QACvC,WAAW;QACX,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,MAAM;QACjD,eAAe,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YAClD,GAAG,EAAE,KAAK;YACV,UAAU;YACV,KAAK,EAAE,iCAAiC;SACzC,EAAE,iCAAiC,CAAC;QACrC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YAC/B,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,wBAAwB;SAChC,EAAE,wBAAwB,CAAC;KAC7B,CAAC,CAAC;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IACzB,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@hile/core").ServiceRegisterProps<import("../sitemap/sitemap-aggregator.js").SitemapAggregator>;
2
+ export default _default;
3
+ //# sourceMappingURL=sitemap.boot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap.boot.d.ts","sourceRoot":"","sources":["../../src/services/sitemap.boot.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { defineService, loadService } from '@hile/core';
2
+ import sitemapRuntimeService from './sitemap-runtime.service.js';
3
+ export default defineService('zlooks.sitemap.boot', async () => loadService(sitemapRuntimeService));
4
+ //# sourceMappingURL=sitemap.boot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap.boot.js","sourceRoot":"","sources":["../../src/services/sitemap.boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,qBAAqB,MAAM,8BAA8B,CAAC;AAEjE,eAAe,aAAa,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ApplicationCallOptions } from '@hile/micro';
2
+ import { type SitemapReadResponse } from '@zlooks.cn/sitemap-contract';
3
+ interface RegistryTopicSnapshot {
4
+ readonly topic: string;
5
+ readonly payload: unknown;
6
+ readonly hasData: boolean;
7
+ readonly retained: boolean;
8
+ readonly publisherCount: number;
9
+ readonly publishers: readonly unknown[];
10
+ }
11
+ interface SitemapApplication {
12
+ listRegistryTopicSnapshots(prefix: string, options: {
13
+ readonly signal: AbortSignal;
14
+ }): Promise<readonly RegistryTopicSnapshot[]>;
15
+ call(namespace: string, operation: string, data: unknown, options: ApplicationCallOptions): Promise<unknown>;
16
+ }
17
+ export interface SitemapAggregatorOptions {
18
+ readonly application: SitemapApplication;
19
+ readonly readOrigin: () => string;
20
+ readonly clock?: () => Date;
21
+ readonly pollIntervalMs?: number;
22
+ readonly maxSnapshotStaleMs?: number;
23
+ readonly onProviderError?: (providerId: string, error: unknown) => void;
24
+ readonly onError?: (error: unknown) => void;
25
+ }
26
+ export declare class SitemapAggregator {
27
+ #private;
28
+ constructor(options: SitemapAggregatorOptions);
29
+ start(): Promise<void>;
30
+ refresh(): Promise<void>;
31
+ read(): SitemapReadResponse;
32
+ close(): Promise<void>;
33
+ private reconcile;
34
+ private discover;
35
+ private readProvider;
36
+ private pruneStaleSnapshots;
37
+ private rebuildDocument;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=sitemap-aggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-aggregator.d.ts","sourceRoot":"","sources":["../../src/sitemap/sitemap-aggregator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAUL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AAGrC,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,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CAGjC;IAEY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAOlC;YAEa,SAAS;YA4BT,QAAQ;YA0BR,YAAY;IAgC1B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,eAAe;CAYxB"}
@@ -0,0 +1,241 @@
1
+ import { createExecutionContext } from '@hile/context';
2
+ import { SITEMAP_MAX_ENTRIES, SITEMAP_PROVIDER_OPERATION, SITEMAP_PROVIDER_TOPIC_PREFIX, SITEMAP_SERVICE_NAMESPACE, parseSitemapProviderAnnouncement, parseSitemapProviderPage, sitemapProviderTopic, } from '@zlooks.cn/sitemap-contract';
3
+ import { buildSitemapDocument } from './sitemap-document.js';
4
+ const MAX_PROVIDERS = 64;
5
+ const MAX_ANNOUNCEMENTS = 256;
6
+ const MAX_LEASE_MS = 30_000;
7
+ const PROVIDER_REFRESH_CONCURRENCY = 8;
8
+ export class SitemapAggregator {
9
+ #options;
10
+ #state;
11
+ constructor(options) {
12
+ this.#options = {
13
+ ...options,
14
+ clock: options.clock ?? (() => new Date()),
15
+ pollIntervalMs: positiveInteger(options.pollIntervalMs ?? 10_000),
16
+ maxSnapshotStaleMs: positiveInteger(options.maxSnapshotStaleMs ?? 86_400_000),
17
+ };
18
+ this.#state = {
19
+ snapshots: new Map(),
20
+ abort: new AbortController(),
21
+ timer: undefined,
22
+ active: undefined,
23
+ document: undefined,
24
+ closed: false,
25
+ };
26
+ }
27
+ async start() {
28
+ if (this.#state.closed)
29
+ throw new Error('Sitemap aggregator is closed');
30
+ await this.refresh();
31
+ if (this.#state.closed || this.#state.timer)
32
+ return;
33
+ this.#state.timer = setInterval(() => {
34
+ void this.refresh().catch((error) => this.#options.onError?.(error));
35
+ }, this.#options.pollIntervalMs);
36
+ this.#state.timer.unref();
37
+ }
38
+ refresh() {
39
+ if (this.#state.closed)
40
+ return Promise.reject(new Error('Sitemap aggregator is closed'));
41
+ if (this.#state.active)
42
+ return this.#state.active;
43
+ const operation = this.reconcile();
44
+ this.#state.active = operation;
45
+ void operation.finally(() => {
46
+ if (this.#state.active === operation)
47
+ this.#state.active = undefined;
48
+ }).catch(() => undefined);
49
+ return operation;
50
+ }
51
+ read() {
52
+ if (!this.#state.document)
53
+ throw new Error('Sitemap is not available');
54
+ return this.#state.document;
55
+ }
56
+ async close() {
57
+ if (this.#state.closed)
58
+ return;
59
+ this.#state.closed = true;
60
+ this.#state.abort.abort(new Error('Sitemap aggregator is closed'));
61
+ if (this.#state.timer)
62
+ clearInterval(this.#state.timer);
63
+ this.#state.timer = undefined;
64
+ await this.#state.active?.catch(() => undefined);
65
+ }
66
+ async reconcile() {
67
+ try {
68
+ const discoverySignal = AbortSignal.any([
69
+ this.#state.abort.signal,
70
+ AbortSignal.timeout(5_000),
71
+ ]);
72
+ const providers = await this.discover(discoverySignal);
73
+ await forEachConcurrent(providers, PROVIDER_REFRESH_CONCURRENCY, async (provider) => {
74
+ try {
75
+ const signal = AbortSignal.any([
76
+ this.#state.abort.signal,
77
+ AbortSignal.timeout(5_000),
78
+ ]);
79
+ const entries = await this.readProvider(provider, signal);
80
+ this.#state.snapshots.set(provider.providerId, {
81
+ entries,
82
+ refreshedAt: this.#options.clock().getTime(),
83
+ });
84
+ }
85
+ catch (error) {
86
+ this.#options.onProviderError?.(provider.providerId, error);
87
+ }
88
+ });
89
+ }
90
+ finally {
91
+ this.pruneStaleSnapshots();
92
+ this.rebuildDocument();
93
+ }
94
+ }
95
+ async discover(signal) {
96
+ const snapshots = await this.#options.application.listRegistryTopicSnapshots(SITEMAP_PROVIDER_TOPIC_PREFIX, { signal });
97
+ if (snapshots.length > MAX_ANNOUNCEMENTS)
98
+ throw new Error('Sitemap Provider announcement limit exceeded');
99
+ const now = this.#options.clock().getTime();
100
+ const groups = new Map();
101
+ for (const snapshot of snapshots) {
102
+ let announcement;
103
+ try {
104
+ announcement = validateAnnouncementSnapshot(snapshot, now);
105
+ }
106
+ catch (error) {
107
+ this.#options.onProviderError?.(providerLabel(snapshot), error);
108
+ continue;
109
+ }
110
+ const replicas = groups.get(announcement.providerId) ?? [];
111
+ replicas.push(announcement);
112
+ groups.set(announcement.providerId, replicas);
113
+ }
114
+ if (groups.size > MAX_PROVIDERS)
115
+ throw new Error('Sitemap Provider limit exceeded');
116
+ const providers = [...groups.values()].map(selectReplicaContract);
117
+ assertNonOverlappingScopes(providers);
118
+ return providers;
119
+ }
120
+ async readProvider(provider, signal) {
121
+ const entries = [];
122
+ const keys = new Set();
123
+ const paths = new Set();
124
+ const cursors = new Set();
125
+ let cursor;
126
+ for (let pageNumber = 0; pageNumber <= SITEMAP_MAX_ENTRIES; pageNumber += 1) {
127
+ signal.throwIfAborted();
128
+ const page = parseSitemapProviderPage(await this.#options.application.call(provider.namespace, SITEMAP_PROVIDER_OPERATION, cursor ? { cursor } : {}, {
129
+ context: createExecutionContext({ source: SITEMAP_SERVICE_NAMESPACE }),
130
+ timeout: 5_000,
131
+ retries: 1,
132
+ signal,
133
+ }), provider.scopePrefix);
134
+ appendUniqueEntries(entries, page.items, keys, paths);
135
+ if (entries.length > SITEMAP_MAX_ENTRIES)
136
+ throw new Error('Sitemap entry limit exceeded');
137
+ if (!page.nextCursor)
138
+ return Object.freeze(entries);
139
+ if (cursors.has(page.nextCursor))
140
+ throw new Error('Sitemap Provider cursor loop detected');
141
+ cursors.add(page.nextCursor);
142
+ cursor = page.nextCursor;
143
+ }
144
+ throw new Error('Sitemap Provider page limit exceeded');
145
+ }
146
+ pruneStaleSnapshots() {
147
+ const oldest = this.#options.clock().getTime() - this.#options.maxSnapshotStaleMs;
148
+ for (const [providerId, snapshot] of this.#state.snapshots) {
149
+ if (snapshot.refreshedAt < oldest)
150
+ this.#state.snapshots.delete(providerId);
151
+ }
152
+ }
153
+ rebuildDocument() {
154
+ const entries = [...this.#state.snapshots.values()].flatMap((snapshot) => snapshot.entries);
155
+ if (entries.length === 0) {
156
+ this.#state.document = undefined;
157
+ return;
158
+ }
159
+ try {
160
+ this.#state.document = buildSitemapDocument(this.#options.readOrigin(), entries);
161
+ }
162
+ catch (error) {
163
+ this.#options.onError?.(error);
164
+ }
165
+ }
166
+ }
167
+ async function forEachConcurrent(values, concurrency, operation) {
168
+ let next = 0;
169
+ await Promise.all(Array.from({ length: Math.min(concurrency, values.length) }, async () => {
170
+ while (next < values.length) {
171
+ const value = values[next];
172
+ next += 1;
173
+ if (value !== undefined)
174
+ await operation(value);
175
+ }
176
+ }));
177
+ }
178
+ function providerLabel(snapshot) {
179
+ if (typeof snapshot.payload !== 'object' || snapshot.payload === null)
180
+ return 'unknown';
181
+ const providerId = Reflect.get(snapshot.payload, 'providerId');
182
+ return typeof providerId === 'string' && providerId.length <= 128 ? providerId : 'unknown';
183
+ }
184
+ function validateAnnouncementSnapshot(snapshot, now) {
185
+ const announcement = parseSitemapProviderAnnouncement(snapshot.payload);
186
+ if (!snapshot.hasData || snapshot.retained || snapshot.publisherCount !== 1
187
+ || snapshot.publishers.length !== 1 || snapshot.topic !== sitemapProviderTopic(announcement)
188
+ || announcement.issuedAt > now + 1_000 || announcement.expiresAt <= now
189
+ || announcement.expiresAt <= announcement.issuedAt
190
+ || announcement.expiresAt - announcement.issuedAt > MAX_LEASE_MS) {
191
+ throw new Error('Invalid live Sitemap Provider announcement');
192
+ }
193
+ return announcement;
194
+ }
195
+ function selectReplicaContract(replicas) {
196
+ const selected = replicas[0];
197
+ if (!selected)
198
+ throw new Error('Sitemap Provider has no replicas');
199
+ const fingerprint = providerFingerprint(selected);
200
+ if (replicas.some((replica) => providerFingerprint(replica) !== fingerprint)) {
201
+ throw new Error(`Sitemap Provider replicas disagree: ${selected.providerId}`);
202
+ }
203
+ return selected;
204
+ }
205
+ function providerFingerprint(provider) {
206
+ return JSON.stringify([provider.namespace, provider.operation, provider.scopePrefix]);
207
+ }
208
+ function assertNonOverlappingScopes(providers) {
209
+ for (let left = 0; left < providers.length; left += 1) {
210
+ for (let right = left + 1; right < providers.length; right += 1) {
211
+ const a = providers[left];
212
+ const b = providers[right];
213
+ if (a && b && scopesOverlap(a.scopePrefix, b.scopePrefix)) {
214
+ throw new Error(`Sitemap Provider scopes overlap: ${a.providerId}, ${b.providerId}`);
215
+ }
216
+ }
217
+ }
218
+ }
219
+ function scopesOverlap(left, right) {
220
+ return left === '/' || right === '/'
221
+ || left === right
222
+ || left.startsWith(`${right}/`)
223
+ || right.startsWith(`${left}/`);
224
+ }
225
+ function appendUniqueEntries(target, source, keys, paths) {
226
+ for (const entry of source) {
227
+ if (keys.has(entry.key))
228
+ throw new Error(`Duplicate Sitemap entry key: ${entry.key}`);
229
+ if (paths.has(entry.path))
230
+ throw new Error(`Duplicate Sitemap entry path: ${entry.path}`);
231
+ keys.add(entry.key);
232
+ paths.add(entry.path);
233
+ target.push(entry);
234
+ }
235
+ }
236
+ function positiveInteger(value) {
237
+ if (!Number.isSafeInteger(value) || value <= 0)
238
+ throw new TypeError('Expected a positive integer');
239
+ return value;
240
+ }
241
+ //# sourceMappingURL=sitemap-aggregator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-aggregator.js","sourceRoot":"","sources":["../../src/sitemap/sitemap-aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,EACzB,gCAAgC,EAChC,wBAAwB,EACxB,oBAAoB,GAIrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAuC7D,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,MAAM,OAAO,iBAAiB;IACnB,QAAQ,CAGkD;IAC1D,MAAM,CAOb;IAEF,YAAmB,OAAiC;QAClD,IAAI,CAAC,QAAQ,GAAG;YACd,GAAG,OAA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IAAI,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;WAC/B,IAAI,KAAK,KAAK;WACd,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC;WAC5B,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,mBAAmB,CAC1B,MAAsB,EACtB,MAA+B,EAC/B,IAAiB,EACjB,KAAkB;IAElB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QACtF,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1F,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;IACnG,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type SitemapEntry, type SitemapReadResponse } from '@zlooks.cn/sitemap-contract';
2
+ export declare function buildSitemapDocument(origin: string, entries: readonly SitemapEntry[]): SitemapReadResponse;
3
+ //# sourceMappingURL=sitemap-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-document.d.ts","sourceRoot":"","sources":["../../src/sitemap/sitemap-document.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AAIrC,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,YAAY,EAAE,GAC/B,mBAAmB,CAgBrB"}
@@ -0,0 +1,56 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { SITEMAP_MAX_BYTES, SITEMAP_MAX_ENTRIES, parseSitemapReadResponse, } from '@zlooks.cn/sitemap-contract';
3
+ const XML_HEADER = '<?xml version="1.0" encoding="UTF-8"?>';
4
+ export function buildSitemapDocument(origin, entries) {
5
+ if (entries.length === 0)
6
+ throw new Error('Cannot publish an empty Sitemap');
7
+ if (entries.length > SITEMAP_MAX_ENTRIES)
8
+ throw new Error('Sitemap entry limit exceeded');
9
+ const ordered = [...entries].sort((left, right) => left.path.localeCompare(right.path));
10
+ assertUniquePaths(ordered);
11
+ const xml = `${XML_HEADER}\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${ordered
12
+ .map((entry) => serializeEntry(origin, entry))
13
+ .join('\n')}\n</urlset>\n`;
14
+ if (Buffer.byteLength(xml) > SITEMAP_MAX_BYTES)
15
+ throw new Error('Sitemap byte limit exceeded');
16
+ const lastModified = newestModification(ordered);
17
+ return parseSitemapReadResponse({
18
+ xml,
19
+ etag: `"${createHash('sha256').update(xml).digest('hex')}"`,
20
+ lastModified,
21
+ entryCount: ordered.length,
22
+ });
23
+ }
24
+ function serializeEntry(origin, entry) {
25
+ const location = escapeXml(new URL(entry.path, origin).toString());
26
+ const modified = entry.lastModified
27
+ ? `\n <lastmod>${escapeXml(entry.lastModified)}</lastmod>`
28
+ : '';
29
+ return ` <url>\n <loc>${location}</loc>${modified}\n </url>`;
30
+ }
31
+ function assertUniquePaths(entries) {
32
+ const paths = new Set();
33
+ for (const entry of entries) {
34
+ if (paths.has(entry.path))
35
+ throw new Error(`Duplicate Sitemap path: ${entry.path}`);
36
+ paths.add(entry.path);
37
+ }
38
+ }
39
+ function newestModification(entries) {
40
+ return entries.reduce((latest, entry) => {
41
+ if (!entry.lastModified)
42
+ return latest;
43
+ if (!latest || Date.parse(entry.lastModified) > Date.parse(latest))
44
+ return entry.lastModified;
45
+ return latest;
46
+ }, null);
47
+ }
48
+ function escapeXml(value) {
49
+ return value
50
+ .replaceAll('&', '&amp;')
51
+ .replaceAll('<', '&lt;')
52
+ .replaceAll('>', '&gt;')
53
+ .replaceAll('"', '&quot;')
54
+ .replaceAll("'", '&apos;');
55
+ }
56
+ //# sourceMappingURL=sitemap-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitemap-document.js","sourceRoot":"","sources":["../../src/sitemap/sitemap-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,GAGzB,MAAM,6BAA6B,CAAC;AAErC,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAE5D,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,OAAgC;IAEhC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC7E,IAAI,OAAO,CAAC,MAAM,GAAG,mBAAmB;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,GAAG,GAAG,GAAG,UAAU,mEAAmE,OAAO;SAChG,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE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,OAAO,CAAC,MAAM,CAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACrD,IAAI,CAAC,KAAK,CAAC,YAAY;YAAE,OAAO,MAAM,CAAC;QACvC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC,YAAY,CAAC;QAC9F,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@zlooks.cn/sitemap-server",
3
+ "version": "1.0.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=24.0.0"
8
+ },
9
+ "bin": {
10
+ "zlooks-sitemap-server": "dist/command/index.js"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "zlooks": {
16
+ "kind": "service",
17
+ "description": "站点 Sitemap 聚合服务",
18
+ "dependsOn": []
19
+ },
20
+ "scripts": {
21
+ "build": "pnpm run clean && tsc -p tsconfig.json && fix-esm-import-path --preserve-import-type ./dist",
22
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
23
+ "dev": "hile start --dev --env-file ~/.zlooks.cn/.env",
24
+ "start": "hile start --env-file ~/.zlooks.cn/.env",
25
+ "test": "vitest run",
26
+ "typecheck": "tsc -p tsconfig.json --noEmit"
27
+ },
28
+ "dependencies": {
29
+ "@hile/context": "4.0.3",
30
+ "@hile/core": "4.0.2",
31
+ "@hile/logger": "4.0.2",
32
+ "@hile/message-loader": "4.0.6",
33
+ "@hile/micro": "4.0.6",
34
+ "@hile/model": "4.0.4",
35
+ "@zlooks.cn/public-host-contract": "1.0.0",
36
+ "@zlooks.cn/registry-config": "1.0.1",
37
+ "@zlooks.cn/service-command": "1.0.1",
38
+ "@zlooks.cn/sitemap-contract": "1.0.1",
39
+ "detect-port": "2.1.0"
40
+ },
41
+ "devDependencies": {
42
+ "@hile/cli": "4.0.7",
43
+ "@types/node": "26.2.0",
44
+ "fix-esm-import-path": "1.10.3",
45
+ "typescript": "7.0.2",
46
+ "vitest": "4.1.11"
47
+ },
48
+ "gitHead": "3c7e3ec494a3702626a2b150991b136b89550e35"
49
+ }