@stencil/dev-server 0.0.19-0 → 5.0.0-alpha.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/{LICENSE → LICENSE.md} +12 -6
- package/dist/client/index.d.ts +132 -0
- package/dist/client/index.js +1076 -0
- package/dist/connector.html +34 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.mjs +1395 -0
- package/dist/static/favicon.ico +0 -0
- package/dist/templates/directory-index.html +186 -0
- package/dist/templates/initial-load.html +157 -0
- package/dist/worker-thread.js +63 -0
- package/package.json +50 -51
- package/static/favicon.ico +0 -0
- package/templates/directory-index.html +186 -0
- package/templates/initial-load.html +157 -0
- package/README.md +0 -57
- package/assets/404.html +0 -14
- package/assets/__stencil-dev-server__/favicon.ico +0 -0
- package/assets/index.html +0 -39
- package/bin/stencil-dev-server +0 -16
- package/dist/definitions.js +0 -2
- package/dist/index.js +0 -275
- package/dist/middlewares.js +0 -106
- package/dist/promisify.js +0 -18
- package/dist/utils.js +0 -139
package/{LICENSE → LICENSE.md}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2019-present Drifty Co.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -9,13 +9,19 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
copies or substantial portions of the Software.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
SOFTWARE.
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
22
|
+
|
|
23
|
+
-----------------------------------------
|
|
24
|
+
Third-party components, software, and/or libraries (collectively, "components")
|
|
25
|
+
are included under the licenses specified by their authors. For information
|
|
26
|
+
about these third-party licenses, refer to the separate legal notices governing
|
|
27
|
+
such components at NOTICE file at the top level of the package.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { CompilerBuildResults, Diagnostic, HmrStyleUpdate, HotModuleReplacement, PrintLine } from "@stencil/core/compiler";
|
|
2
|
+
|
|
3
|
+
//#region src/client/types.d.ts
|
|
4
|
+
interface DevClientWindow extends Window {
|
|
5
|
+
's-dev-server'?: boolean;
|
|
6
|
+
's-initial-load'?: boolean;
|
|
7
|
+
's-build-id'?: number;
|
|
8
|
+
devServerConfig?: DevClientConfig;
|
|
9
|
+
WebSocket: typeof WebSocket;
|
|
10
|
+
}
|
|
11
|
+
interface DevClientConfig {
|
|
12
|
+
basePath: string;
|
|
13
|
+
editors: DevServerEditor[];
|
|
14
|
+
reloadStrategy: 'hmr' | 'pageReload' | null;
|
|
15
|
+
socketUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
interface DevServerEditor {
|
|
18
|
+
id: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
}
|
|
21
|
+
interface DevServerMessage {
|
|
22
|
+
buildResults?: CompilerBuildResults;
|
|
23
|
+
buildLog?: BuildLog;
|
|
24
|
+
isActivelyBuilding?: boolean;
|
|
25
|
+
requestBuildResults?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface BuildLog {
|
|
28
|
+
buildId: number;
|
|
29
|
+
messages: string[];
|
|
30
|
+
progress: number;
|
|
31
|
+
}
|
|
32
|
+
interface HostElement extends Element {
|
|
33
|
+
's-hmr'?: (versionId: string) => void;
|
|
34
|
+
}
|
|
35
|
+
interface OpenInEditorData {
|
|
36
|
+
file?: string;
|
|
37
|
+
line?: number;
|
|
38
|
+
column?: number;
|
|
39
|
+
editor?: string;
|
|
40
|
+
}
|
|
41
|
+
interface HmrResults {
|
|
42
|
+
updatedComponents: string[];
|
|
43
|
+
updatedExternalStyles: string[];
|
|
44
|
+
updatedInlineStyles: string[];
|
|
45
|
+
updatedImages: string[];
|
|
46
|
+
versionId: string;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/client/constants.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* Client-side constants for dev server.
|
|
52
|
+
*/
|
|
53
|
+
declare const DEV_SERVER_URL = "/~dev-server";
|
|
54
|
+
declare const DEV_SERVER_INIT_URL = "/~dev-server-init";
|
|
55
|
+
declare const OPEN_IN_EDITOR_URL = "/~dev-server-open-in-editor";
|
|
56
|
+
declare const BUILD_LOG = "devserver:buildlog";
|
|
57
|
+
declare const BUILD_RESULTS = "devserver:buildresults";
|
|
58
|
+
declare const BUILD_STATUS = "devserver:buildstatus";
|
|
59
|
+
declare const NODE_TYPE_ELEMENT = 1;
|
|
60
|
+
declare const NODE_TYPE_DOCUMENT_FRAGMENT = 11;
|
|
61
|
+
declare const RECONNECT_ATTEMPTS = 1000;
|
|
62
|
+
declare const RECONNECT_RETRY_MS = 2500;
|
|
63
|
+
declare const NORMAL_CLOSURE_CODE = 1000;
|
|
64
|
+
declare const REQUEST_BUILD_RESULTS_INTERVAL_MS = 500;
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/client/error.d.ts
|
|
67
|
+
interface AppErrorData {
|
|
68
|
+
window: Window;
|
|
69
|
+
buildResults: any;
|
|
70
|
+
openInEditor?: OpenInEditorCallback;
|
|
71
|
+
}
|
|
72
|
+
type OpenInEditorCallback = (data: {
|
|
73
|
+
file: string;
|
|
74
|
+
line: number;
|
|
75
|
+
column: number;
|
|
76
|
+
}) => void;
|
|
77
|
+
interface AppErrorResults {
|
|
78
|
+
diagnostics: Diagnostic[];
|
|
79
|
+
status: null | string;
|
|
80
|
+
}
|
|
81
|
+
declare const appError: (data: AppErrorData) => AppErrorResults;
|
|
82
|
+
declare const clearAppErrorModal: (data: {
|
|
83
|
+
window: Window;
|
|
84
|
+
}) => void;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/client/events.d.ts
|
|
87
|
+
declare const emitBuildLog: (win: Window, buildLog: BuildLog) => void;
|
|
88
|
+
declare const emitBuildResults: (win: Window, buildResults: CompilerBuildResults) => void;
|
|
89
|
+
declare const emitBuildStatus: (win: Window, buildStatus: string) => void;
|
|
90
|
+
declare const onBuildLog: (win: Window, cb: (buildLog: BuildLog) => void) => void;
|
|
91
|
+
declare const onBuildResults: (win: Window, cb: (buildResults: CompilerBuildResults) => void) => void;
|
|
92
|
+
declare const onBuildStatus: (win: Window, cb: (buildStatus: string) => void) => void;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/client/hmr/window.d.ts
|
|
95
|
+
interface HmrWindowData {
|
|
96
|
+
window: Window;
|
|
97
|
+
hmr: HotModuleReplacement;
|
|
98
|
+
}
|
|
99
|
+
declare const hmrWindow: (data: HmrWindowData) => HmrResults;
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/client/logger.d.ts
|
|
102
|
+
declare const logBuild: (msg: string) => void;
|
|
103
|
+
declare const logReload: (msg: string) => void;
|
|
104
|
+
declare const logWarn: (prefix: string, msg: string) => void;
|
|
105
|
+
declare const logDisabled: (prefix: string, msg: string) => void;
|
|
106
|
+
declare const logDiagnostic: (diag: Diagnostic) => void;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/client/status.d.ts
|
|
109
|
+
/**
|
|
110
|
+
* Build status and favicon utilities for dev server client.
|
|
111
|
+
*/
|
|
112
|
+
declare const initBuildStatus: (data: {
|
|
113
|
+
window: Window;
|
|
114
|
+
}) => void;
|
|
115
|
+
declare const updateFavIcon: (linkElm: HTMLLinkElement, status: string) => void;
|
|
116
|
+
declare const initBuildProgress: (data: {
|
|
117
|
+
window: Window;
|
|
118
|
+
}) => void;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/client/websocket.d.ts
|
|
121
|
+
declare const initClientWebSocket: (win: DevClientWindow, config: DevClientConfig) => void;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/client/index.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Initialize the dev server client in the browser.
|
|
126
|
+
*
|
|
127
|
+
* @param win - the dev client window object
|
|
128
|
+
* @param config - the dev client configuration
|
|
129
|
+
*/
|
|
130
|
+
declare const initDevClient: (win: DevClientWindow, config: DevClientConfig) => void;
|
|
131
|
+
//#endregion
|
|
132
|
+
export { BUILD_LOG, BUILD_RESULTS, BUILD_STATUS, BuildLog, type CompilerBuildResults, DEV_SERVER_INIT_URL, DEV_SERVER_URL, DevClientConfig, DevClientWindow, DevServerEditor, DevServerMessage, type Diagnostic, HmrResults, type HmrStyleUpdate, HostElement, type HotModuleReplacement, NODE_TYPE_DOCUMENT_FRAGMENT, NODE_TYPE_ELEMENT, NORMAL_CLOSURE_CODE, OPEN_IN_EDITOR_URL, OpenInEditorData, type PrintLine, RECONNECT_ATTEMPTS, RECONNECT_RETRY_MS, REQUEST_BUILD_RESULTS_INTERVAL_MS, appError, clearAppErrorModal, emitBuildLog, emitBuildResults, emitBuildStatus, hmrWindow, initBuildProgress, initBuildStatus, initClientWebSocket, initDevClient, logBuild, logDiagnostic, logDisabled, logReload, logWarn, onBuildLog, onBuildResults, onBuildStatus, updateFavIcon };
|