@travetto/doc 5.0.0-rc.8 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/doc",
3
- "version": "5.0.0-rc.8",
3
+ "version": "5.0.0",
4
4
  "description": "Documentation support for the Travetto framework",
5
5
  "keywords": [
6
6
  "docs",
@@ -24,12 +24,12 @@
24
24
  "directory": "module/doc"
25
25
  },
26
26
  "dependencies": {
27
- "@travetto/runtime": "^5.0.0-rc.8",
27
+ "@travetto/runtime": "^5.0.0",
28
28
  "@types/prismjs": "^1.26.4",
29
29
  "prismjs": "^1.29.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/cli": "^5.0.0-rc.8"
32
+ "@travetto/cli": "^5.0.0"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@travetto/cli": {
package/src/jsx.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createElement, JSXElement, JSXComponentFunction as CompFn } from '@travetto/doc/jsx-runtime';
2
- import { TypedObject } from '@travetto/runtime';
2
+ import { castTo, TypedObject } from '@travetto/runtime';
3
3
 
4
4
  import { LIB_MAPPING } from './mapping/lib-mapping';
5
5
  import { MOD_MAPPING } from './mapping/mod-mapping';
@@ -65,7 +65,7 @@ export type JSXElements = { [K in keyof C]: JSXElementByFn<K>; };
65
65
 
66
66
  export const EMPTY_ELEMENT = EMPTY;
67
67
 
68
- const invertedC = new Map<Function, string>(TypedObject.entries(c).map(p => [p[1], p[0]] as [CompFn, string]));
68
+ const invertedC = new Map<Function, string>(TypedObject.entries(c).map<[Function, string]>(p => [p[1], p[0]]));
69
69
 
70
70
  export function getComponentName(fn: Function | string): string {
71
71
  if (typeof fn === 'string') {
@@ -81,7 +81,7 @@ function CodeLinker(titleOrNode: string | JSXElement, src?: string, startRe?: Re
81
81
  if (typeof titleOrNode === 'string') {
82
82
  props = { title: titleOrNode, src: src!, startRe: startRe! };
83
83
  } else if (titleOrNode.type === Code) {
84
- const node = titleOrNode as unknown as JSXElementByFn<'Code'>;
84
+ const node: JSXElementByFn<'Code'> = castTo(titleOrNode);
85
85
  props = {
86
86
  title: node.props.title,
87
87
  src: node.props.src,
@@ -90,7 +90,7 @@ function CodeLinker(titleOrNode: string | JSXElement, src?: string, startRe?: Re
90
90
  } else {
91
91
  throw new Error(`Unsupported element type: ${titleOrNode.type}`);
92
92
  }
93
- return createElement(c.CodeLink, props) as JSXElementByFn<'CodeLink'>;
93
+ return createElement(c.CodeLink, props);
94
94
  }
95
95
 
96
96
  export const d = {
@@ -82,6 +82,7 @@ export const LIB_MAPPING = {
82
82
  ImageMagick: { title: 'ImageMagick', href: 'https://imagemagick.org/index.php' },
83
83
  PngQuant: { title: 'pngquant', href: 'https://pngquant.org/' },
84
84
  JpegOptim: { title: 'Jpegoptim', href: 'https://github.com/tjko/jpegoptim' },
85
+ Sharp: { title: 'sharp', href: 'https://sharp.pixelplumbing.com/' },
85
86
 
86
87
  // Dbs
87
88
  MongoDB: { title: 'mongodb', href: 'https://mongodb.com' },
@@ -1,12 +1,4 @@
1
1
  export const MOD_MAPPING = {
2
- Asset: {
3
- name: '@travetto/asset', folder: '@travetto/asset', displayName: 'Asset',
4
- description: 'Modular library for storing and retrieving binary assets'
5
- },
6
- AssetRest: {
7
- name: '@travetto/asset-rest', folder: '@travetto/asset-rest', displayName: 'Asset Rest Support',
8
- description: 'Provides integration between the travetto asset and rest module.'
9
- },
10
2
  Auth: {
11
3
  name: '@travetto/auth', folder: '@travetto/auth', displayName: 'Authentication',
12
4
  description: 'Authentication scaffolding for the Travetto framework'
@@ -31,10 +23,6 @@ export const MOD_MAPPING = {
31
23
  name: '@travetto/auth-rest-session', folder: '@travetto/auth-rest-session', displayName: 'Rest Auth Session',
32
24
  description: 'Rest authentication session integration support for the Travetto framework'
33
25
  },
34
- Base: {
35
- name: '@travetto/runtime', folder: '@travetto/runtime', displayName: 'Base',
36
- description: 'Environment config and common utilities for travetto applications.'
37
- },
38
26
  Cache: {
39
27
  name: '@travetto/cache', folder: '@travetto/cache', displayName: 'Caching',
40
28
  description: 'Caching functionality with decorators for declarative use.'
@@ -115,10 +103,18 @@ export const MOD_MAPPING = {
115
103
  name: '@travetto/model-elasticsearch', folder: '@travetto/model-elasticsearch', displayName: 'Elasticsearch Model Source',
116
104
  description: 'Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.'
117
105
  },
106
+ ModelFile: {
107
+ name: '@travetto/model-file', folder: '@travetto/model-file', displayName: 'File Model Support',
108
+ description: 'File system backing for the travetto model module.'
109
+ },
118
110
  ModelFirestore: {
119
111
  name: '@travetto/model-firestore', folder: '@travetto/model-firestore', displayName: 'Firestore Model Support',
120
112
  description: 'Firestore backing for the travetto model module.'
121
113
  },
114
+ ModelMemory: {
115
+ name: '@travetto/model-memory', folder: '@travetto/model-memory', displayName: 'Memory Model Support',
116
+ description: 'Memory backing for the travetto model module.'
117
+ },
122
118
  ModelMongo: {
123
119
  name: '@travetto/model-mongo', folder: '@travetto/model-mongo', displayName: 'MongoDB Model Support',
124
120
  description: 'Mongo backing for the travetto model module.'
@@ -135,6 +131,10 @@ export const MOD_MAPPING = {
135
131
  name: '@travetto/model-query', folder: '@travetto/model-query', displayName: 'Data Model Querying',
136
132
  description: 'Datastore abstraction for advanced query support.'
137
133
  },
134
+ ModelQueryLanguage: {
135
+ name: '@travetto/model-query-language', folder: '@travetto/model-query-language', displayName: 'Data Model Query Language',
136
+ description: 'Datastore query language.'
137
+ },
138
138
  ModelRedis: {
139
139
  name: '@travetto/model-redis', folder: '@travetto/model-redis', displayName: 'Redis Model Support',
140
140
  description: 'Redis backing for the travetto model module.'
@@ -219,6 +219,10 @@ export const MOD_MAPPING = {
219
219
  name: '@travetto/rest-upload', folder: '@travetto/rest-upload', displayName: 'Rest Upload Support',
220
220
  description: 'Provides integration between the travetto asset and rest module.'
221
221
  },
222
+ Runtime: {
223
+ name: '@travetto/runtime', folder: '@travetto/runtime', displayName: 'Runtime',
224
+ description: 'Runtime for travetto applications.'
225
+ },
222
226
  Scaffold: {
223
227
  name: '@travetto/scaffold', folder: '@travetto/scaffold', displayName: 'App Scaffold',
224
228
  description: 'App Scaffold for the Travetto framework'
@@ -1,4 +1,4 @@
1
- import { default as prismjs } from 'prismjs';
1
+ import { default as prismJs } from 'prismjs';
2
2
 
3
3
  import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace.js';
4
4
  import 'prismjs/components/prism-typescript.js';
@@ -12,20 +12,20 @@ import 'prismjs/components/prism-sql.js';
12
12
  import 'prismjs/components/prism-properties.js';
13
13
  import 'prismjs/components/prism-bash.js';
14
14
 
15
- prismjs.plugins.NormalizeWhitespace.setDefaults({
15
+ prismJs.plugins.NormalizeWhitespace.setDefaults({
16
16
  'remove-trailing': true,
17
17
  'remove-indent': true,
18
18
  'left-trim': true,
19
19
  'right-trim': true
20
20
  });
21
21
 
22
- const nw = prismjs.plugins.NormalizeWhitespace;
22
+ const nw = prismJs.plugins.NormalizeWhitespace;
23
23
 
24
24
  const tokenMapping: { [key: string]: string } = {
25
- gt: '>',
26
- lt: '<',
27
- quot: '"',
28
- apos: "'"
25
+ '&gt;': '>',
26
+ '&lt;': '<',
27
+ '&quot;': '"',
28
+ '&apos;': "'"
29
29
  };
30
30
 
31
31
  export function highlight(text: string, lang: string): string | undefined {
@@ -35,10 +35,10 @@ export function highlight(text: string, lang: string): string | undefined {
35
35
 
36
36
  text = text
37
37
  .replace(/&#(\d+);/g, (x, code) => String.fromCharCode(code))
38
- .replace(/&([a-z][^;]*);/g, (a, k) => tokenMapping[k] || a);
38
+ .replace(/&[a-z][^;]*;/g, a => tokenMapping[a] || a);
39
39
 
40
40
  try {
41
- return prismjs.highlight(text, prismjs.languages[lang], lang)
41
+ return prismJs.highlight(text, prismJs.languages[lang], lang)
42
42
  .replace(/(@\s*<span[^>]*)function("\s*>)/g, (a, pre, post) => `${pre}meta${post}`)
43
43
  .replace(/[{}]/g, a => `{{'${a}'}}`);
44
44
  } catch (err) {
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import { createElement, JSXRuntimeTag } from '@travetto/doc/jsx-runtime';
4
4
 
5
5
  import { PackageUtil } from '@travetto/manifest';
6
- import { RuntimeIndex } from '@travetto/runtime';
6
+ import { castTo, RuntimeIndex } from '@travetto/runtime';
7
7
 
8
8
  import { JSXElementByFn, c } from '../jsx';
9
9
  import { DocResolveUtil, ResolvedCode, ResolvedRef, ResolvedSnippetLink } from '../util/resolve';
@@ -125,6 +125,6 @@ export class RenderContext {
125
125
  */
126
126
  createElement<K extends keyof typeof c>(name: K, props: JSXElementByFn<K>['props']): JSXElementByFn<K> {
127
127
  // @ts-expect-error
128
- return createElement(c[name], props) as JSXElementByFn<K>;
128
+ return castTo(createElement(c[name], props));
129
129
  }
130
130
  }
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
 
3
3
  import { type ManifestContext, PackageUtil } from '@travetto/manifest';
4
4
  import { isJSXElement, JSXElement, JSXFragmentType } from '@travetto/doc/jsx-runtime';
5
- import { Runtime } from '@travetto/runtime';
5
+ import { castTo, Runtime } from '@travetto/runtime';
6
6
 
7
7
  import { EMPTY_ELEMENT, getComponentName, JSXElementByFn, c } from '../jsx';
8
8
  import { DocumentShape, RenderProvider, RenderState } from '../types';
@@ -55,8 +55,7 @@ export class DocRenderer {
55
55
  let final: JSXElement = node;
56
56
  // Render simple element if needed
57
57
  if (typeof node.type === 'function' && node.type !== JSXFragmentType) {
58
- // @ts-expect-error
59
- const out = node.type(node.props);
58
+ const out = castTo<Function>(node.type)(node.props);
60
59
  final = out !== EMPTY_ELEMENT ? out : final;
61
60
  }
62
61