tungsten 0.2.25 → 0.3.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.
- package/dist/ContentNode.d.ts +7 -0
- package/dist/ContentNode.d.ts.map +1 -1
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +7 -5
- package/dist/Instance/gotoRedirect.sxyt.d.ts +2 -0
- package/dist/Instance/gotoRedirect.sxyt.d.ts.map +1 -0
- package/dist/Instance/gotoRedirect.sxyt.js +148 -0
- package/dist/Servers/DevServer.d.ts +7 -0
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +38 -1
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +10 -1
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +86 -1
- package/dist/build/compileStyles.d.ts +1 -1
- package/dist/build/compileStyles.d.ts.map +1 -1
- package/dist/build/compileStyles.js +10 -4
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +7 -2
- package/dist/components/RawHtml.d.ts +36 -0
- package/dist/components/RawHtml.d.ts.map +1 -0
- package/dist/components/RawHtml.js +30 -0
- package/dist/components/RawHtml.sxyt.d.ts +2 -0
- package/dist/components/RawHtml.sxyt.d.ts.map +1 -0
- package/dist/components/RawHtml.sxyt.js +104 -0
- package/dist/dev/liveReloadHub.d.ts +6 -0
- package/dist/dev/liveReloadHub.d.ts.map +1 -0
- package/dist/dev/liveReloadHub.js +12 -0
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +11 -4
- package/dist/hydrate/reconcileHydratedAttributes.d.ts +24 -0
- package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -0
- package/dist/hydrate/reconcileHydratedAttributes.js +73 -0
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +2 -0
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +1 -0
- package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +173 -0
- package/dist/indexInner.d.ts +4 -0
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +3 -0
- package/dist/innerHtmlFromProps.d.ts +16 -0
- package/dist/innerHtmlFromProps.d.ts.map +1 -0
- package/dist/innerHtmlFromProps.js +31 -0
- package/dist/innerHtmlFromProps.sxyt.d.ts +2 -0
- package/dist/innerHtmlFromProps.sxyt.d.ts.map +1 -0
- package/dist/innerHtmlFromProps.sxyt.js +99 -0
- package/dist/rawHtml/HtmlAllowList.d.ts +17 -0
- package/dist/rawHtml/HtmlAllowList.d.ts.map +1 -0
- package/dist/rawHtml/HtmlAllowList.js +1 -0
- package/dist/rawHtml/decodeHtmlEntities.d.ts +8 -0
- package/dist/rawHtml/decodeHtmlEntities.d.ts.map +1 -0
- package/dist/rawHtml/decodeHtmlEntities.js +105 -0
- package/dist/rawHtml/htmlParsingTags.d.ts +23 -0
- package/dist/rawHtml/htmlParsingTags.d.ts.map +1 -0
- package/dist/rawHtml/htmlParsingTags.js +55 -0
- package/dist/rawHtml/parseHtml.d.ts +35 -0
- package/dist/rawHtml/parseHtml.d.ts.map +1 -0
- package/dist/rawHtml/parseHtml.js +214 -0
- package/dist/rawHtml/parseHtml.sxyt.d.ts +2 -0
- package/dist/rawHtml/parseHtml.sxyt.d.ts.map +1 -0
- package/dist/rawHtml/parseHtml.sxyt.js +239 -0
- package/dist/rawHtml/safeHtmlAllowList.d.ts +18 -0
- package/dist/rawHtml/safeHtmlAllowList.d.ts.map +1 -0
- package/dist/rawHtml/safeHtmlAllowList.js +47 -0
- package/dist/rawHtml/tokenizeHtml.d.ts +25 -0
- package/dist/rawHtml/tokenizeHtml.d.ts.map +1 -0
- package/dist/rawHtml/tokenizeHtml.js +148 -0
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +10 -0
- package/dist/render/processProps.d.ts.map +1 -1
- package/dist/render/processProps.js +14 -2
- package/dist/render/processProps.sxyt.d.ts +2 -0
- package/dist/render/processProps.sxyt.d.ts.map +1 -0
- package/dist/render/processProps.sxyt.js +90 -0
- package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
- package/dist/render/renderingTreeToHtml.js +8 -0
- package/dist/routing/RouteTypes.d.ts +1 -1
- package/dist/routing/RouteTypes.d.ts.map +1 -1
- package/dist/routing/routeSymbols.d.ts +9 -0
- package/dist/routing/routeSymbols.d.ts.map +1 -0
- package/dist/routing/routeSymbols.js +4 -0
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +28 -7
- package/package.json +3 -3
package/dist/ContentNode.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export type NodeProps = {
|
|
|
16
16
|
__zoneHtml?: string;
|
|
17
17
|
/** Prevent Tungsten from reconciling descendants of this host element. */
|
|
18
18
|
__opaque?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* React-compatible raw inner HTML. Replaces the element's children, and
|
|
21
|
+
* its parsed nodes are never reconciled. See innerHtmlFromProps().
|
|
22
|
+
*/
|
|
23
|
+
dangerouslySetInnerHTML?: {
|
|
24
|
+
__html: string;
|
|
25
|
+
};
|
|
19
26
|
[key: string]: unknown;
|
|
20
27
|
};
|
|
21
28
|
export type ContentNodeHtml = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentNode.d.ts","sourceRoot":"","sources":["../src/ContentNode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EACH,yBAAyB,EAAE,qBAAqB,EAAE,0BAA0B,EAC5E,gCAAgC,EAAE,gCAAgC,EACrE,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAg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kE/B;IASD,QAAQ,GAAI,KAAK,MAAM,EAAE,OAAM,YAAkB,UAShD;IACD,eAAe,GAAI,cAAc,MAAM,UAEtC;IACD,QAAQ,GAAI,OAAO,MAAM,UAIxB;IACD,iBAAiB,aAEhB;IAKD,WAAW,GAAI,WAAW,MAAM,GAAG;QAC/B,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;QAChC,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC7B,aAYA;IAED,SAAS,GAAI,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,aAAa,MAAM,aAKjE;IAED,SAAS,GAAI,MAAM,MAAM,OAAO,EAAE,aAAa,MAAM,UAIpD;IAED,iBAAiB,GAAI,WAAW,mBAAmB,UAElD;IAED,mBAAmB,GAAI,WAAW,mBAAmB,UAGpD;IAED,2BAA2B,aAM1B;CACJ;AAID,wBAAgB,cAAc,CAC1B,IAAI,EAAE,MAAM,OAAO,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,IAA6B,QAejF"}
|
|
@@ -66,11 +66,13 @@ export class Instance {
|
|
|
66
66
|
this.goto(redirect.to);
|
|
67
67
|
return;
|
|
68
68
|
} else if (matchedRouteInfo.data instanceof WebRedirect) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
69
|
+
// A WebRedirect names a URL rather than a route, so it leaves the
|
|
70
|
+
// application — exactly as a WebRedirectComponent returned as
|
|
71
|
+
// content does below. On the server redirect() writes an HTTP
|
|
72
|
+
// redirect; in the browser it replaces the location.
|
|
73
|
+
const redirect = matchedRouteInfo.data;
|
|
74
|
+
this.redirect(redirect.to, redirect.code);
|
|
75
|
+
return;
|
|
74
76
|
}
|
|
75
77
|
// handle Redirect components
|
|
76
78
|
// if (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gotoRedirect.sxyt.d.ts","sourceRoot":"","sources":["../../src/Instance/gotoRedirect.sxyt.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { describe } from 'sxy-test-runner';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
// aliased: an unaliased `Window` would shadow the DOM Window type the
|
|
4
|
+
// runtime context is declared with
|
|
5
|
+
import { Window as HappyWindow } from 'happy-dom';
|
|
6
|
+
import { Instance } from "./Instance.js";
|
|
7
|
+
import { WebRedirect } from "../routing/WebRedirect.js";
|
|
8
|
+
import { RoutingRedirect } from "../routing/RoutingRedirect.js";
|
|
9
|
+
import { initStores } from "../Servers/initStores.js";
|
|
10
|
+
import { UpdateScheduler } from "../update/UpdateScheduler.js";
|
|
11
|
+
// A client-side Instance whose hard redirects are recorded rather than
|
|
12
|
+
// performed. Only the routing and redirect paths are exercised, so the rest of
|
|
13
|
+
// the runtime is left at its defaults.
|
|
14
|
+
const makeInstance = routes => {
|
|
15
|
+
const replaced = [];
|
|
16
|
+
const pushed = [];
|
|
17
|
+
const happyWindow = new HappyWindow();
|
|
18
|
+
// Only the two things goto() reaches for: a hard redirect leaves through
|
|
19
|
+
// location.replace, and an in-app navigation records history.
|
|
20
|
+
const fakeWindow = {
|
|
21
|
+
location: {
|
|
22
|
+
replace: url => {
|
|
23
|
+
replaced.push(url);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
history: {
|
|
27
|
+
pushState: (_state, _title, url) => {
|
|
28
|
+
pushed.push(url);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const runtimeContext = {
|
|
33
|
+
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
34
|
+
document: happyWindow.document,
|
|
35
|
+
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
36
|
+
window: fakeWindow,
|
|
37
|
+
scheduler: new UpdateScheduler(),
|
|
38
|
+
navigation: false
|
|
39
|
+
};
|
|
40
|
+
const matchedRouteInfo = {
|
|
41
|
+
key: null,
|
|
42
|
+
params: {},
|
|
43
|
+
content: null
|
|
44
|
+
};
|
|
45
|
+
const globalData = {}; // eslint-disable-line no-type-assertion/no-type-assertion
|
|
46
|
+
const {
|
|
47
|
+
internalStore,
|
|
48
|
+
stores,
|
|
49
|
+
storeSubscriptions
|
|
50
|
+
} = initStores('/', null, globalData, matchedRouteInfo);
|
|
51
|
+
const config = {
|
|
52
|
+
prod: false,
|
|
53
|
+
useRootComponent: true,
|
|
54
|
+
clientSideNav: false,
|
|
55
|
+
siteBasePath: '/',
|
|
56
|
+
staticSite: false
|
|
57
|
+
};
|
|
58
|
+
const instance = new Instance('/', config, null,
|
|
59
|
+
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
60
|
+
routes, routes,
|
|
61
|
+
// eslint-disable-line no-type-assertion/no-type-assertion
|
|
62
|
+
internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, runtimeContext);
|
|
63
|
+
return {
|
|
64
|
+
instance,
|
|
65
|
+
replaced,
|
|
66
|
+
pushed
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const legacyUrl = 'http://legacy.test/';
|
|
70
|
+
describe('Instance.goto() redirects', ({
|
|
71
|
+
it
|
|
72
|
+
}) => {
|
|
73
|
+
// A WebRedirect names a URL, not a route, so it has to leave the
|
|
74
|
+
// application. Client-side navigation used to throw here, which meant a
|
|
75
|
+
// session that expired between page load and a Link click hit an error
|
|
76
|
+
// instead of the log in page.
|
|
77
|
+
it('leaves the application for a WebRedirect returned by route data', async () => {
|
|
78
|
+
const {
|
|
79
|
+
instance,
|
|
80
|
+
replaced
|
|
81
|
+
} = makeInstance({
|
|
82
|
+
'/gone': {
|
|
83
|
+
content: null,
|
|
84
|
+
data: async () => new WebRedirect(legacyUrl)
|
|
85
|
+
},
|
|
86
|
+
'404': {
|
|
87
|
+
content: null
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
await instance.goto('/gone');
|
|
91
|
+
expect(replaced).to.deep.equal([legacyUrl]);
|
|
92
|
+
});
|
|
93
|
+
it('does not adopt the redirect as the current route', async () => {
|
|
94
|
+
const {
|
|
95
|
+
instance
|
|
96
|
+
} = makeInstance({
|
|
97
|
+
'/gone': {
|
|
98
|
+
content: null,
|
|
99
|
+
data: async () => new WebRedirect(legacyUrl)
|
|
100
|
+
},
|
|
101
|
+
'404': {
|
|
102
|
+
content: null
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
await instance.goto('/gone');
|
|
106
|
+
// it left the app; the route it was heading for never became current
|
|
107
|
+
expect(instance.matchedRouteInfo.key).to.not.equal('/gone');
|
|
108
|
+
});
|
|
109
|
+
it('still routes within the application for a RoutingRedirect', async () => {
|
|
110
|
+
const {
|
|
111
|
+
instance,
|
|
112
|
+
replaced
|
|
113
|
+
} = makeInstance({
|
|
114
|
+
'/old': {
|
|
115
|
+
content: null,
|
|
116
|
+
data: async () => new RoutingRedirect('/new')
|
|
117
|
+
},
|
|
118
|
+
'/new': {
|
|
119
|
+
content: null
|
|
120
|
+
},
|
|
121
|
+
'404': {
|
|
122
|
+
content: null
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
await instance.goto('/old');
|
|
126
|
+
expect(replaced).to.deep.equal([]);
|
|
127
|
+
expect(instance.matchedRouteInfo.key).to.equal('/new');
|
|
128
|
+
});
|
|
129
|
+
it('does not redirect for an ordinary data result', async () => {
|
|
130
|
+
const {
|
|
131
|
+
instance,
|
|
132
|
+
replaced
|
|
133
|
+
} = makeInstance({
|
|
134
|
+
'/ok': {
|
|
135
|
+
content: null,
|
|
136
|
+
data: async () => ({
|
|
137
|
+
value: 1
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
'404': {
|
|
141
|
+
content: null
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
await instance.goto('/ok');
|
|
145
|
+
expect(replaced).to.deep.equal([]);
|
|
146
|
+
expect(instance.matchedRouteInfo.key).to.equal('/ok');
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -23,8 +23,15 @@ export declare class DevServer extends TungstenServer {
|
|
|
23
23
|
firstRender: boolean;
|
|
24
24
|
iterationCount: number;
|
|
25
25
|
serverIterationCount: number;
|
|
26
|
+
private liveReloadClients;
|
|
27
|
+
private unsubscribeReload;
|
|
26
28
|
constructor(framework: Framework, config: FrameworkConfigComplete, compilationInfo: CompilationInfo, initialProcessEnv?: Record<string, string>);
|
|
27
29
|
private addServerMiddleware;
|
|
30
|
+
private handleLiveReloadStream;
|
|
31
|
+
private reloadDebounceTimer;
|
|
32
|
+
private pendingReloadKind;
|
|
33
|
+
private static readonly reloadDebounceMs;
|
|
34
|
+
private broadcastReloadEvent;
|
|
28
35
|
private handleRequestApi;
|
|
29
36
|
private handleRequest;
|
|
30
37
|
getGlobalData: (func: GlobalDataFunction, reqRes: ReqRes) => Promise<GlobalData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevServer.d.ts","sourceRoot":"","sources":["../../src/Servers/DevServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,OAA4D,MAAM,SAAS,CAAA;AAElF,OAAO,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAwB,MAAM,uBAAuB,CAAA;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAMpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAW3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,UAAU,EAAkB,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAEjG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"DevServer.d.ts","source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AE,eAAe,EACvF,iBAAiB,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IA0HlD,OAAO,CAAC,mBAAmB,CAyE1B;IAKD,OAAO,CAAC,sBAAsB,CAO7B;IACD,OAAO,CAAC,mBAAmB,CAA8B;IACzD,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAM;IAC9C,OAAO,CAAC,oBAAoB,CAc3B;IACD,OAAO,CAAC,gBAAgB,CAcvB;IAED,OAAO,CAAC,aAAa,CAwMpB;IAID,aAAa,GAAU,MAAM,kBAAkB,EAAE,QAAQ,MAAM,yBAQ9D;IACD,QAAQ,GAAI,OAAO,OAAO,UAIzB;IACD,SAAS,GAAI,OAAO,OAAO,EAAE,YAAY,MAAM,EAAE,YAehD;IACD,KAAK,QAAO,OAAO,CAAC,MAAM,CAAC,CAO1B;IACD,IAAI,aAMH;CAGJ"}
|
|
@@ -26,6 +26,7 @@ import { loadEnvsDev } from "./loadEnvsDev.js";
|
|
|
26
26
|
import { initStores } from "./initStores.js";
|
|
27
27
|
import { MatchedRoute } from "../routing/MatchedRoute.js";
|
|
28
28
|
import { iterationQueryString } from "../iterationQueryString.js";
|
|
29
|
+
import { onReloadEvent } from "../dev/liveReloadHub.js";
|
|
29
30
|
//import cookieParser from 'cookie-parser'
|
|
30
31
|
function debug(...texts) {
|
|
31
32
|
// console.log(...texts)
|
|
@@ -48,6 +49,8 @@ export class DevServer extends TungstenServer {
|
|
|
48
49
|
_defineProperty(this, "firstRender", true);
|
|
49
50
|
_defineProperty(this, "iterationCount", 0);
|
|
50
51
|
_defineProperty(this, "serverIterationCount", 0);
|
|
52
|
+
_defineProperty(this, "liveReloadClients", new Set());
|
|
53
|
+
_defineProperty(this, "unsubscribeReload", null);
|
|
51
54
|
_defineProperty(this, "addServerMiddleware", serverMiddleware => {
|
|
52
55
|
//console.log('addServerMiddleware')
|
|
53
56
|
const [middlewareFile, middlewareExportName, middlewarePath] = serverMiddleware;
|
|
@@ -113,6 +116,33 @@ export class DevServer extends TungstenServer {
|
|
|
113
116
|
// //
|
|
114
117
|
// console.log('Server is handling server rpc')
|
|
115
118
|
// }
|
|
119
|
+
_defineProperty(this, "handleLiveReloadStream", (req, res) => {
|
|
120
|
+
res.setHeader('Content-Type', 'text/event-stream');
|
|
121
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
122
|
+
res.setHeader('Connection', 'keep-alive');
|
|
123
|
+
res.flushHeaders();
|
|
124
|
+
this.liveReloadClients.add(res);
|
|
125
|
+
req.on('close', () => {
|
|
126
|
+
this.liveReloadClients.delete(res);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
_defineProperty(this, "reloadDebounceTimer", null);
|
|
130
|
+
_defineProperty(this, "pendingReloadKind", null);
|
|
131
|
+
_defineProperty(this, "broadcastReloadEvent", kind => {
|
|
132
|
+
// A single save can fire several filesystem events in quick succession -
|
|
133
|
+
// tsc's writer often truncates a file before writing its new contents, and each
|
|
134
|
+
// of those steps runs back through this framework's own watch -> transform -> write
|
|
135
|
+
// cycle. Reloading on the first signal can land the browser on a momentarily
|
|
136
|
+
// half-written file, so wait for the burst to go quiet before actually reloading.
|
|
137
|
+
this.pendingReloadKind = this.pendingReloadKind === 'js' || kind === 'js' ? 'js' : kind;
|
|
138
|
+
if (this.reloadDebounceTimer !== null) clearTimeout(this.reloadDebounceTimer);
|
|
139
|
+
this.reloadDebounceTimer = setTimeout(() => {
|
|
140
|
+
const finalKind = this.pendingReloadKind ?? kind;
|
|
141
|
+
for (const client of this.liveReloadClients) client.write(`event: ${finalKind}\ndata: reload\n\n`);
|
|
142
|
+
this.reloadDebounceTimer = null;
|
|
143
|
+
this.pendingReloadKind = null;
|
|
144
|
+
}, DevServer.reloadDebounceMs);
|
|
145
|
+
});
|
|
116
146
|
_defineProperty(this, "handleRequestApi", async (req, res, next) => {
|
|
117
147
|
req.params.foo;
|
|
118
148
|
this.apiRoutes = await getApiRoutes(this.config, this.compilationInfo, 'dev');
|
|
@@ -335,6 +365,10 @@ export class DevServer extends TungstenServer {
|
|
|
335
365
|
});
|
|
336
366
|
_defineProperty(this, "stop", () => {
|
|
337
367
|
if (this.server !== undefined) this.server.close();
|
|
368
|
+
this.unsubscribeReload?.();
|
|
369
|
+
if (this.reloadDebounceTimer !== null) clearTimeout(this.reloadDebounceTimer);
|
|
370
|
+
for (const client of this.liveReloadClients) client.end();
|
|
371
|
+
this.liveReloadClients.clear();
|
|
338
372
|
});
|
|
339
373
|
try {
|
|
340
374
|
this.framework = framework;
|
|
@@ -414,6 +448,8 @@ export class DevServer extends TungstenServer {
|
|
|
414
448
|
dotfiles: 'allow'
|
|
415
449
|
})); // serving the compiled app files
|
|
416
450
|
//this.app.use('/__server_rpc__', this.handleRpc)
|
|
451
|
+
this.app.get('/__tungsten_live_reload__', this.handleLiveReloadStream);
|
|
452
|
+
this.unsubscribeReload = onReloadEvent(this.broadcastReloadEvent);
|
|
417
453
|
if (typeof config.apiRoutes === 'string' && config.apiRoutes !== '') {
|
|
418
454
|
const apiPath = this.apiPath = standardizeWebPath(this.config.apiPath);
|
|
419
455
|
cliOut(`API listening at ${this.apiPath}`);
|
|
@@ -429,4 +465,5 @@ export class DevServer extends TungstenServer {
|
|
|
429
465
|
throw new TungstenError(`${this.constructor.name} construction error: ${e}`);
|
|
430
466
|
}
|
|
431
467
|
}
|
|
432
|
-
}
|
|
468
|
+
}
|
|
469
|
+
_defineProperty(DevServer, "reloadDebounceMs", 200);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGjE,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GAC5G,OAAO,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/Servers/routing.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAGjE,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GAC5G,OAAO,CAAC,gBAAgB,CAAC,CA0D9B"}
|
package/dist/Servers/routing.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Default404 } from "../routing/Default404.js";
|
|
|
2
2
|
import { matchPath } from "../routing/matchPath.js";
|
|
3
3
|
import { jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
4
4
|
export async function routing(location, routes, serverDataLoading = null) {
|
|
5
|
-
let defaultRoute, _404Route;
|
|
5
|
+
let defaultRoute, _404Route, errorRoute;
|
|
6
6
|
// try the current path against each defined route
|
|
7
7
|
// routeNode is a Route node in the children tree
|
|
8
8
|
// this is assuming an array
|
|
@@ -17,6 +17,10 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
17
17
|
_404Route = route;
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
+
if (path === 'error') {
|
|
21
|
+
errorRoute = route;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
20
24
|
const match = matchPath(path, location);
|
|
21
25
|
if (match !== null) {
|
|
22
26
|
const params = match.params;
|
|
@@ -46,6 +50,11 @@ export async function routing(location, routes, serverDataLoading = null) {
|
|
|
46
50
|
params: {},
|
|
47
51
|
content: _404Route.content
|
|
48
52
|
};
|
|
53
|
+
if (errorRoute) return {
|
|
54
|
+
key: 'error',
|
|
55
|
+
params: {},
|
|
56
|
+
content: errorRoute.content
|
|
57
|
+
};
|
|
49
58
|
return {
|
|
50
59
|
key: null,
|
|
51
60
|
params: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;CAC9F,CAAA;AAKD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAA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AAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,CA6YlC"}
|
|
@@ -49,12 +49,24 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
49
49
|
const codeLocationLength = codeLocation.length + 1;
|
|
50
50
|
const transformPromises = [];
|
|
51
51
|
const failedFiles = new Set();
|
|
52
|
+
const pendingExportWipes = new Map();
|
|
53
|
+
const exportWipeGraceMs = 5000;
|
|
52
54
|
async function transformFile(file) {
|
|
53
55
|
if (options.quiet !== true) console.log('transforming file', file);
|
|
54
56
|
try {
|
|
55
57
|
let rel = file.slice(codeLocationLength);
|
|
56
58
|
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
57
59
|
const dest = join(buildCodeLocation, rel);
|
|
60
|
+
// tsc's own watch/incremental emit can leave this file genuinely blank for a
|
|
61
|
+
// stretch while it recomputes - not a write-in-progress chokidar's
|
|
62
|
+
// awaitWriteFinish can wait out, but a real (if temporary) empty file on disk.
|
|
63
|
+
// Skip the cycle rather than overwrite a previously-good compiled output with
|
|
64
|
+
// a blank one; the real content arriving shortly after will retrigger this watcher.
|
|
65
|
+
const sourceContent = await fsPromises.readFile(file, 'utf8');
|
|
66
|
+
if (sourceContent.trim() === '') {
|
|
67
|
+
failedFiles.delete(file);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
58
70
|
const result = await babeltransformFileAsync(file, config);
|
|
59
71
|
if (result === null) throw new TungstenError(`Err: babel transform on file ${file} returned null`);
|
|
60
72
|
const {
|
|
@@ -63,6 +75,44 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
63
75
|
if (code === null || code === undefined) {
|
|
64
76
|
throw new TungstenError(`Err: code from babel transform on file ${file} was null or undefined: ${typeof code}`);
|
|
65
77
|
}
|
|
78
|
+
// tsc's incremental watch can, for one transient pass right after a save, emit
|
|
79
|
+
// `export {};` for a file that previously had real exports - its own convention
|
|
80
|
+
// for "this module has nothing to export", produced here as a self-correcting
|
|
81
|
+
// glitch rather than a real edit (confirmed via tsc's own transient
|
|
82
|
+
// "has no exported member" watch error). Quarantine it behind a timer rather than
|
|
83
|
+
// overwrite the last-good compiled output immediately: tsc's follow-up pass moments
|
|
84
|
+
// later normally retriggers this watcher with the real content, cancelling the
|
|
85
|
+
// quarantine below. But if nothing ever corrects it (a genuine edit really does
|
|
86
|
+
// remove every export), accept the quarantined content once the grace period lapses
|
|
87
|
+
// instead of hiding it forever.
|
|
88
|
+
if (code.trim() === 'export {};' && fs.existsSync(dest)) {
|
|
89
|
+
const previousCode = fs.readFileSync(dest, 'utf8');
|
|
90
|
+
if (previousCode.trim() !== 'export {};' && previousCode.trim() !== '') {
|
|
91
|
+
if (!pendingExportWipes.has(file)) {
|
|
92
|
+
const timer = setTimeout(() => {
|
|
93
|
+
void acceptQuarantinedExportWipe(file);
|
|
94
|
+
}, exportWipeGraceMs);
|
|
95
|
+
pendingExportWipes.set(file, {
|
|
96
|
+
dest,
|
|
97
|
+
code,
|
|
98
|
+
timer
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
// keep the original timer (grace period counts from the first sighting),
|
|
102
|
+
// just refresh the content that'll be written if it elapses
|
|
103
|
+
const pending = pendingExportWipes.get(file);
|
|
104
|
+
if (pending !== undefined) pending.code = code;
|
|
105
|
+
}
|
|
106
|
+
failedFiles.delete(file);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// real content arrived - cancel any quarantine still pending for this file
|
|
111
|
+
const pendingWipe = pendingExportWipes.get(file);
|
|
112
|
+
if (pendingWipe !== undefined) {
|
|
113
|
+
clearTimeout(pendingWipe.timer);
|
|
114
|
+
pendingExportWipes.delete(file);
|
|
115
|
+
}
|
|
66
116
|
await fsPromises.mkdir(dirname(dest), {
|
|
67
117
|
recursive: true
|
|
68
118
|
});
|
|
@@ -81,6 +131,11 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
81
131
|
let rel = file.slice(codeLocationLength);
|
|
82
132
|
if (rel.endsWith('.jsx')) rel = rel.slice(0, -1);
|
|
83
133
|
const dest = join(buildCodeLocation, rel);
|
|
134
|
+
const pendingWipe = pendingExportWipes.get(file);
|
|
135
|
+
if (pendingWipe !== undefined) {
|
|
136
|
+
clearTimeout(pendingWipe.timer);
|
|
137
|
+
pendingExportWipes.delete(file);
|
|
138
|
+
}
|
|
84
139
|
try {
|
|
85
140
|
await fsPromises.unlink(dest);
|
|
86
141
|
} catch (error) {
|
|
@@ -167,6 +222,30 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
167
222
|
}
|
|
168
223
|
fs.writeFileSync(dependencyGraphLocation, `export const graph = ${serializeJavascript(dependencyGraph)}`);
|
|
169
224
|
}
|
|
225
|
+
async function acceptQuarantinedExportWipe(file) {
|
|
226
|
+
const pending = pendingExportWipes.get(file);
|
|
227
|
+
if (pending === undefined) return;
|
|
228
|
+
pendingExportWipes.delete(file);
|
|
229
|
+
let success = false;
|
|
230
|
+
try {
|
|
231
|
+
await fsPromises.mkdir(dirname(pending.dest), {
|
|
232
|
+
recursive: true
|
|
233
|
+
});
|
|
234
|
+
fs.writeFileSync(pending.dest, pending.code);
|
|
235
|
+
failedFiles.delete(file);
|
|
236
|
+
const failures = await settleDeferredWork();
|
|
237
|
+
success = failures.length === 0 && failedFiles.size === 0;
|
|
238
|
+
if (success) writeDependencyGraph();
|
|
239
|
+
} catch (e) {
|
|
240
|
+
failedFiles.add(file);
|
|
241
|
+
cliError(`Tungsten: Error accepting quarantined export wipe for ${file}`);
|
|
242
|
+
cliLog(e);
|
|
243
|
+
}
|
|
244
|
+
await options.onCycleComplete?.({
|
|
245
|
+
success,
|
|
246
|
+
file
|
|
247
|
+
});
|
|
248
|
+
}
|
|
170
249
|
if (!watch) {
|
|
171
250
|
if (!initialSuccess) {
|
|
172
251
|
throw new AggregateError(initialFailures, 'One or more JavaScript files could not be compiled');
|
|
@@ -183,8 +262,14 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
183
262
|
}
|
|
184
263
|
const watcher = chokidar.watch(watchGlob, {
|
|
185
264
|
ignored,
|
|
186
|
-
ignoreInitial: true
|
|
265
|
+
ignoreInitial: true,
|
|
187
266
|
//useFsEvents: false
|
|
267
|
+
// tsc's writer can touch a file more than once per emit (e.g. truncate then write);
|
|
268
|
+
// without this, chokidar fires on the first write and we can read a half-written file.
|
|
269
|
+
awaitWriteFinish: {
|
|
270
|
+
stabilityThreshold: 100,
|
|
271
|
+
pollInterval: 10
|
|
272
|
+
}
|
|
188
273
|
});
|
|
189
274
|
let watchCycle = Promise.resolve();
|
|
190
275
|
watcher.on('all', (event, file) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FrameworkConfigComplete } from '../FrameworkConfig.js';
|
|
2
|
-
export declare function compileStyles(projectDir: string, config: FrameworkConfigComplete, styleImportBase: string, buildLocation: string, watch?: boolean): Promise<unknown>;
|
|
2
|
+
export declare function compileStyles(projectDir: string, config: FrameworkConfigComplete, styleImportBase: string, buildLocation: string, watch?: boolean, onChange?: () => void): Promise<unknown>;
|
|
3
3
|
//# sourceMappingURL=compileStyles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileStyles.d.ts","sourceRoot":"","sources":["../../src/build/compileStyles.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAgOpE,wBAAsB,aAAa,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,uBAAuB,EAC/B,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,KAAK,UAAO,
|
|
1
|
+
{"version":3,"file":"compileStyles.d.ts","sourceRoot":"","sources":["../../src/build/compileStyles.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAgOpE,wBAAsB,aAAa,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,uBAAuB,EAC/B,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,KAAK,UAAO,EACZ,QAAQ,CAAC,EAAE,MAAM,IAAI,oBAiGxB"}
|
|
@@ -183,7 +183,7 @@ async function processAndCopyFile(sourceLocation, targetLocation, filePathFull,
|
|
|
183
183
|
}
|
|
184
184
|
cssFiles[targetRelFile] = relFile;
|
|
185
185
|
}
|
|
186
|
-
export async function compileStyles(projectDir, config, styleImportBase, buildLocation, watch = true) {
|
|
186
|
+
export async function compileStyles(projectDir, config, styleImportBase, buildLocation, watch = true, onChange) {
|
|
187
187
|
cliOut(`Compiling app stylesheets`);
|
|
188
188
|
// we need to create and maintain a dependency tree for correct updating
|
|
189
189
|
// we are going to save the dependencies of each file
|
|
@@ -221,17 +221,23 @@ export async function compileStyles(projectDir, config, styleImportBase, buildLo
|
|
|
221
221
|
return null;
|
|
222
222
|
}
|
|
223
223
|
const watcher = chokidar.watch(watchGlob, {
|
|
224
|
-
ignored: ignoreGlob
|
|
224
|
+
ignored: ignoreGlob,
|
|
225
225
|
//ignoreInitial: true
|
|
226
|
+
awaitWriteFinish: {
|
|
227
|
+
stabilityThreshold: 100,
|
|
228
|
+
pollInterval: 10
|
|
229
|
+
}
|
|
226
230
|
});
|
|
227
231
|
watcher.on('all', async (event, filename) => {
|
|
228
232
|
filename = slash(filename);
|
|
229
233
|
debug('[styles watch event]', '(' + event + ')', filename);
|
|
230
234
|
if (event === 'add') {
|
|
231
|
-
processAndCopyFile(sourceLocation, staticLocation, filename, styleImportBase, cssFiles, cssDependencies, cssdependers);
|
|
235
|
+
await processAndCopyFile(sourceLocation, staticLocation, filename, styleImportBase, cssFiles, cssDependencies, cssdependers);
|
|
236
|
+
onChange?.();
|
|
232
237
|
}
|
|
233
238
|
if (event === 'change') {
|
|
234
|
-
processAndCopyFile(sourceLocation, staticLocation, filename, styleImportBase, cssFiles, cssDependencies, cssdependers);
|
|
239
|
+
await processAndCopyFile(sourceLocation, staticLocation, filename, styleImportBase, cssFiles, cssDependencies, cssdependers);
|
|
240
|
+
onChange?.();
|
|
235
241
|
}
|
|
236
242
|
// delete
|
|
237
243
|
// remove from transformedFiles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAWtC,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,GACnE,OAAO,CAAC,eAAe,CAAC,CAoD1B"}
|
|
@@ -5,6 +5,7 @@ import { copyAssets } from "./copyAssets.js";
|
|
|
5
5
|
import { copyPublicFiles } from "./copyPublicFiles.js";
|
|
6
6
|
import { buildCodeSubPath, bundleFolder, devBuildOuterFolder, prodBuildFolder } from "../settings.js";
|
|
7
7
|
import { combineComponentCss } from "./combineComponentCss.js";
|
|
8
|
+
import { emitReloadEvent } from "../dev/liveReloadHub.js";
|
|
8
9
|
//import { compileEnv } from './compileEnv.js'
|
|
9
10
|
export async function compileUserApp(projectDir, appConfig, mode) {
|
|
10
11
|
const codeLocation = join(projectDir, appConfig.codeDir);
|
|
@@ -14,9 +15,13 @@ export async function compileUserApp(projectDir, appConfig, mode) {
|
|
|
14
15
|
const buildLocation = mode === 'dev' ? join(projectDir, devBuildOuterFolder) : join(projectDir, prodBuildFolder);
|
|
15
16
|
const codeSubPath = buildCodeSubPath;
|
|
16
17
|
const buildCodeLocation = join(buildLocation, codeSubPath);
|
|
17
|
-
const compileJavascriptPromise = compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode
|
|
18
|
+
const compileJavascriptPromise = compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode, true, mode === 'dev' ? {
|
|
19
|
+
onCycleComplete: cycle => {
|
|
20
|
+
if (cycle.success) emitReloadEvent('js');
|
|
21
|
+
}
|
|
22
|
+
} : {});
|
|
18
23
|
//const compileEnvPromise = compileEnv(projectDir, appConfig, codeLocation, buildLocation, mode)
|
|
19
|
-
const compileStylesPromise = compileStyles(projectDir, appConfig, styleImportBase, buildLocation);
|
|
24
|
+
const compileStylesPromise = compileStyles(projectDir, appConfig, styleImportBase, buildLocation, true, mode === 'dev' ? () => emitReloadEvent('css') : undefined);
|
|
20
25
|
const copyAssetsPromise = copyAssets(projectDir, appConfig, buildLocation);
|
|
21
26
|
const copyPublicFilesPromise = copyPublicFiles(projectDir, appConfig, buildLocation);
|
|
22
27
|
const {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TungstenSimpleComponent } from '../Components.jsx';
|
|
2
|
+
import type { HtmlAllowList } from '../rawHtml/HtmlAllowList.js';
|
|
3
|
+
export interface RawHtmlProps {
|
|
4
|
+
/** Markup to render. Anything unparseable is kept as text, never thrown on. */
|
|
5
|
+
html: string;
|
|
6
|
+
/**
|
|
7
|
+
* Drop `<script>` elements and `javascript:` URLs. On by default. Turn it
|
|
8
|
+
* off only for markup the application itself produced.
|
|
9
|
+
*/
|
|
10
|
+
sanitize?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Restrict the markup to a set of tags and attributes. Off by default.
|
|
13
|
+
*
|
|
14
|
+
* A disallowed element is unwrapped, not deleted, so its text survives.
|
|
15
|
+
*/
|
|
16
|
+
allowList?: HtmlAllowList;
|
|
17
|
+
/**
|
|
18
|
+
* Shortcut for `allowList={safeHtmlAllowList}` — Tungsten's conservative
|
|
19
|
+
* list for authored rich text. An explicit `allowList` wins over this.
|
|
20
|
+
*/
|
|
21
|
+
safe?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Renders a string of HTML as real content.
|
|
25
|
+
*
|
|
26
|
+
* The markup is parsed into an ordinary Tungsten tree, so it renders, hydrates
|
|
27
|
+
* and reconciles like any other content — unlike `dangerouslySetInnerHTML`,
|
|
28
|
+
* which hands the browser a region Tungsten cannot see into.
|
|
29
|
+
*
|
|
30
|
+
* Note that the parsed elements are not part of any component's scoped CSS, so
|
|
31
|
+
* component styles reach them only through `:i()` / `:ignore()`.
|
|
32
|
+
*/
|
|
33
|
+
export declare class RawHtml extends TungstenSimpleComponent<RawHtmlProps> {
|
|
34
|
+
content: ({ html, sanitize, allowList, safe }: RawHtmlProps) => import("../ContentNode.js").ContentNode;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=RawHtml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RawHtml.d.ts","sourceRoot":"","sources":["../../src/components/RawHtml.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,MAAM,WAAW,YAAY;IACzB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,qBAAa,OAAQ,SAAQ,uBAAuB,CAAC,YAAY,CAAC;IAC9D,OAAO,GAAI,qCAAqC,YAAY,6CAG1D;CACL"}
|