@stencil/dev-server 0.0.19-1 → 5.0.0-alpha.2

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.
Binary file
@@ -0,0 +1,186 @@
1
+ <!doctype html>
2
+ <html dir="ltr" lang="en">
3
+ <head data-tmpl="tmpl-dir">
4
+ <meta charset="utf-8" />
5
+ <title>{{title}}</title>
6
+ <meta
7
+ name="viewport"
8
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
9
+ />
10
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
11
+ <style>
12
+ * {
13
+ box-sizing: border-box;
14
+ }
15
+ html {
16
+ color-scheme: light dark;
17
+ }
18
+ body {
19
+ padding: 40px 140px;
20
+ margin: 0;
21
+ font-family:
22
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
23
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
24
+ font-size: 14px;
25
+ background: #f9f8f8;
26
+ }
27
+ h1 {
28
+ margin-bottom: 15px;
29
+ font-size: 18px;
30
+ color: #343434;
31
+ }
32
+ h1 span {
33
+ padding: 0 6px;
34
+ font-weight: normal;
35
+ color: #9e9b9b;
36
+ }
37
+ a {
38
+ color: #555;
39
+ text-decoration: none;
40
+ }
41
+ a:hover {
42
+ color: #303030;
43
+ }
44
+ ul {
45
+ margin: 0;
46
+ padding: 0;
47
+ }
48
+ li {
49
+ list-style: none;
50
+ margin: 0;
51
+ padding: 0;
52
+ }
53
+ li a {
54
+ display: flex;
55
+ align-items: center;
56
+ gap: 6px;
57
+ margin: 0;
58
+ padding: 6px 12px;
59
+ min-width: 50%;
60
+ border-radius: 4px;
61
+ overflow: hidden;
62
+ white-space: nowrap;
63
+ }
64
+ li a:focus,
65
+ li a:hover {
66
+ color: #555;
67
+ background: rgba(221, 235, 255, 0.65);
68
+ }
69
+ .icon {
70
+ display: inline-block;
71
+ width: 14px;
72
+ min-height: 14px;
73
+ opacity: 0.6;
74
+ mask-repeat: no-repeat;
75
+ -webkit-mask-repeat: no-repeat;
76
+ }
77
+ .directory .icon {
78
+ mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMjEzLjMzOCA5Nkg3NC42NjZDNTEuMTk3IDk2IDMyIDExNS4xOTggMzIgMTM4LjY2N3YyMzQuNjY2QzMyIDM5Ni44MDIgNTEuMTk3IDQxNiA3NC42NjYgNDE2aDM2Mi42NjhDNDYwLjgwMyA0MTYgNDgwIDM5Ni44MDIgNDgwIDM3My4zMzNWMTg2LjY2N0M0ODAgMTYzLjE5OCA0NjAuODAzIDE0NCA0MzcuMzM0IDE0NEgyNTYuMDA2bC00Mi42NjgtNDh6Ii8+PC9zdmc+);
79
+ -webkit-mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMjEzLjMzOCA5Nkg3NC42NjZDNTEuMTk3IDk2IDMyIDExNS4xOTggMzIgMTM4LjY2N3YyMzQuNjY2QzMyIDM5Ni44MDIgNTEuMTk3IDQxNiA3NC42NjYgNDE2aDM2Mi42NjhDNDYwLjgwMyA0MTYgNDgwIDM5Ni44MDIgNDgwIDM3My4zMzNWMTg2LjY2N0M0ODAgMTYzLjE5OCA0NjAuODAzIDE0NCA0MzcuMzM0IDE0NEgyNTYuMDA2bC00Mi42NjgtNDh6Ii8+PC9zdmc+);
80
+ background-position: 0px 2px;
81
+ background-color: currentColor;
82
+ }
83
+ .file .icon {
84
+ mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMjg4IDQ4SDEzNmMtMjIuMDkyIDAtNDAgMTcuOTA4LTQwIDQwdjMzNmMwIDIyLjA5MiAxNy45MDggNDAgNDAgNDBoMjQwYzIyLjA5MiAwIDQwLTE3LjkwOCA0MC00MFYxNzZMMjg4IDQ4em0tMTYgMTQ0VjgwbDExMiAxMTJIMjcyeiIvPjwvc3ZnPg==);
85
+ -webkit-mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMjg4IDQ4SDEzNmMtMjIuMDkyIDAtNDAgMTcuOTA4LTQwIDQwdjMzNmMwIDIyLjA5MiAxNy45MDggNDAgNDAgNDBoMjQwYzIyLjA5MiAwIDQwLTE3LjkwOCA0MC00MFYxNzZMMjg4IDQ4em0tMTYgMTQ0VjgwbDExMiAxMTJIMjcyeiIvPjwvc3ZnPg==);
86
+ background-position: 0px 2px;
87
+ background-color: currentColor;
88
+ }
89
+ li a:hover .icon {
90
+ opacity: 1;
91
+ }
92
+
93
+ @media (max-width: 768px) {
94
+ body {
95
+ font-size: 13px;
96
+ line-height: 16px;
97
+ padding: 0;
98
+ }
99
+ h1 {
100
+ font-size: 2em;
101
+ line-height: 1.5em;
102
+ color: #fff;
103
+ background: #000;
104
+ padding: 15px 10px;
105
+ margin: 0;
106
+ }
107
+ h1 a {
108
+ color: #9e9e9e;
109
+ }
110
+ h1 a:hover {
111
+ color: #eaeaea;
112
+ }
113
+ ul {
114
+ border-top: 1px solid #cacaca;
115
+ }
116
+ li {
117
+ display: block;
118
+ border-bottom: 1px solid #cacaca;
119
+ font-size: 2em;
120
+ line-height: 1.2em;
121
+ }
122
+ li:nth-child(odd) {
123
+ background: #e0e0e0;
124
+ }
125
+ li a {
126
+ display: flex;
127
+ border-radius: 0;
128
+ padding: 15px 10px;
129
+ }
130
+ .icon {
131
+ width: 24px;
132
+ min-width: 24px;
133
+ min-height: 24px;
134
+ }
135
+ .directory .icon {
136
+ background-position: 0px 4px;
137
+ }
138
+ }
139
+
140
+ @media (prefers-color-scheme: dark) {
141
+ body {
142
+ background: #000;
143
+ }
144
+ h1 {
145
+ color: #eaeaea;
146
+ }
147
+ a {
148
+ color: #ccc;
149
+ }
150
+ a:hover {
151
+ color: #eaeaea;
152
+ }
153
+ li a:focus,
154
+ li a:hover {
155
+ color: #ccc;
156
+ background: #1c1c1c;
157
+ }
158
+ }
159
+
160
+ @media (max-width: 768px) and (prefers-color-scheme: dark) {
161
+ ul {
162
+ border-top: 1px solid #333;
163
+ }
164
+ li {
165
+ border-bottom: 1px solid #333;
166
+ }
167
+ li:nth-child(odd) {
168
+ background: #333;
169
+ }
170
+ }
171
+ </style>
172
+ <link
173
+ rel="shortcut icon"
174
+ type="image/png"
175
+ href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAB2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAFGSURBVHic7dm9TcNQFMXxPzRpaZGYAEIqZkERkzAFSwARSyCGgA2QAqGhTZqYIrJkzEP4GfueyD4/6TavuufEH1IMZmZmZmZm382ABfAOFB3MJzANTfAPV8CGboJX5xU4CczRyox+wpfzDByFpWlhQX/hy3kCJlGBcnV1z/81D8BhUKYsW2IKKICboExZosJHzBtwT+bbR710H7MG5qmwB78UMEQb4AJ4qR7u5UOoJxPgun44pisAdm+44+rB2AooqF31Y7oFIPGDj62AH1yAegE1F6BeQM0FqBdQcwHqBdRcgHoBNRegXkDNBagXUHMB6gXUXIB6ATUXoF5ALVXAkP8W39YPUgV8BCyisqofpAp4DFhEpVG2c3ZfU9VfdPv4QnzWtKn5wEpYA5dNw5emwB2w3IMAbWcJ3AKnueHNzMzMzGzYvgAGC6SjvNl9rAAAAABJRU5ErkJggg=="
176
+ />
177
+ </head>
178
+ <body>
179
+ <main>
180
+ <h1>{{nav}}</h1>
181
+ <ul>
182
+ {{files}}
183
+ </ul>
184
+ </main>
185
+ </body>
186
+ </html>
@@ -0,0 +1,157 @@
1
+ <!doctype html>
2
+ <html dir="ltr" lang="en">
3
+ <head data-tmpl="tmpl-initial-load">
4
+ <meta charset="utf-8" />
5
+ <script>
6
+ if ('serviceWorker' in navigator) {
7
+ navigator.serviceWorker
8
+ .getRegistration()
9
+ .then(function (registration) {
10
+ if (registration) {
11
+ registration.unregister().then(function (hasUnregistered) {
12
+ if (hasUnregistered) {
13
+ console.log('unregistered service worker');
14
+ }
15
+ });
16
+ }
17
+ })
18
+ .catch(function (err) {
19
+ console.error(err.message || err);
20
+ });
21
+ }
22
+ </script>
23
+ <meta
24
+ name="viewport"
25
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
26
+ />
27
+ <meta http-equiv="x-ua-compatible" content="IE=Edge" />
28
+ <title>Initializing First Build...</title>
29
+ <link
30
+ rel="shortcut icon"
31
+ type="image/x-icon"
32
+ href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAjVBMVEUAAAD8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjLn7xn3AAAALnRSTlMAsFBgAaDxfPpAdTMcD/fs47kDBhVXJQpvLNbInIiBRvSqIb+TZ2OOONxdzUxpgKSpAAAAA69JREFUeNrt3FtvskAQxvERFQXFioqnCkqth572+3+8947dN00TliF5ZpP53ZOAveg/OzCklFJKKaWUUkoppQTZm77cCGFo+jIhhG/TlwchJAvTk/GIAA6x6Um+JoDti+nJ644A5h+mJ8eMALKj6cnH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XbwDTtYICRRwt7BHqEoppZRSSimllFLqD/8AOXJZHefotiIAAAAASUVORK5CYII="
33
+ />
34
+ <style>
35
+ * {
36
+ box-sizing: border-box;
37
+ }
38
+ html {
39
+ color-scheme: dark light;
40
+ }
41
+ body {
42
+ position: absolute;
43
+ padding: 0;
44
+ margin: 0;
45
+ width: 100%;
46
+ height: 100%;
47
+ font-family:
48
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
49
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
50
+ }
51
+ .toast {
52
+ position: absolute;
53
+ top: 12px;
54
+ right: 10px;
55
+ left: 10px;
56
+ margin: auto;
57
+ max-width: 700px;
58
+ border-radius: 3px;
59
+ background: rgba(0, 0, 0, 0.9);
60
+ transform: translate3d(0px, -60px, 0px);
61
+ transition: transform 75ms ease-out;
62
+ pointer-events: none;
63
+ }
64
+ .active {
65
+ transform: translate3d(0px, 0px, 0px);
66
+ }
67
+ .content {
68
+ display: flex;
69
+ align-items: center;
70
+ pointer-events: auto;
71
+ }
72
+ .message {
73
+ flex: 1;
74
+ padding: 15px;
75
+ font-size: 14px;
76
+ color: #fff;
77
+ }
78
+ .spinner {
79
+ position: relative;
80
+ display: inline-block;
81
+ width: 56px;
82
+ height: 28px;
83
+ }
84
+ svg:not(:root) {
85
+ overflow: hidden;
86
+ }
87
+ svg {
88
+ position: absolute;
89
+ top: 0;
90
+ left: 0;
91
+ width: 100%;
92
+ height: 100%;
93
+ transform: translateZ(0);
94
+ animation: rotate 600ms linear infinite;
95
+ }
96
+ @keyframes rotate {
97
+ 0% {
98
+ transform: rotate(0deg);
99
+ }
100
+ 100% {
101
+ transform: rotate(360deg);
102
+ }
103
+ }
104
+ svg circle {
105
+ fill: transparent;
106
+ stroke: white;
107
+ stroke-width: 4px;
108
+ stroke-dasharray: 128px;
109
+ stroke-dashoffset: 82px;
110
+ }
111
+ .logs {
112
+ position: absolute;
113
+ top: 50px;
114
+ right: 10px;
115
+ left: 10px;
116
+ margin: auto;
117
+ max-width: 700px;
118
+ padding: 32px;
119
+ line-height: 1.5;
120
+ }
121
+
122
+ @media (prefers-color-scheme: dark) {
123
+ .toast {
124
+ background: rgb(49, 49, 49, 0.9);
125
+ }
126
+ }
127
+ </style>
128
+ </head>
129
+ <body>
130
+ <div class="toast">
131
+ <div class="content">
132
+ <div class="message">Initializing First Build...</div>
133
+ <div class="spinner">
134
+ <svg viewBox="0 0 64 64"><circle transform="translate(32,32)" r="26"></circle></svg>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+ <div class="logs">
140
+ <pre id="log-output"></pre>
141
+ </div>
142
+
143
+ <script>
144
+ setTimeout(function () {
145
+ document.querySelector('.toast').classList.add('active');
146
+ }, 100);
147
+
148
+ var logOutput = document.getElementById('log-output');
149
+ window.addEventListener('devserver:buildlog', function (ev) {
150
+ var buildLog = ev.detail;
151
+ if (buildLog && buildLog.messages) {
152
+ logOutput.innerText = buildLog.messages.join('\n');
153
+ }
154
+ });
155
+ </script>
156
+ </body>
157
+ </html>
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Worker thread entry point for dev server.
3
+ * This file is the main entry for the forked child process that runs the HTTP/WebSocket server.
4
+ * It communicates with the parent process via IPC messages.
5
+ */
6
+
7
+ import { initServerProcess } from './index.mjs';
8
+
9
+ let closeTmr = null;
10
+
11
+ /**
12
+ * Handle errors when sending messages to parent process
13
+ *
14
+ * @param err - the error object from process.send
15
+ */
16
+ const sendHandle = (err) => {
17
+ if (err && err.code === 'ERR_IPC_CHANNEL_CLOSED') {
18
+ // Parent process closed the IPC channel, exit cleanly
19
+ process.exit(0);
20
+ }
21
+ };
22
+
23
+ /**
24
+ * Initialize the server process and set up message passing
25
+ */
26
+ const receiveMessageFromMain = initServerProcess((msg) => {
27
+ // Send message from worker going to main
28
+ process.send(msg, sendHandle);
29
+
30
+ if (msg.serverClosed) {
31
+ clearTimeout(closeTmr);
32
+ process.exit(0);
33
+ }
34
+ });
35
+
36
+ /**
37
+ * Receive messages from the main process
38
+ */
39
+ process.on('message', (msg) => {
40
+ if (msg && msg.closeServer) {
41
+ // Set a timeout to force exit if graceful shutdown takes too long
42
+ closeTmr = setTimeout(() => {
43
+ process.exit(0);
44
+ }, 5000);
45
+ }
46
+
47
+ receiveMessageFromMain(msg);
48
+ });
49
+
50
+ /**
51
+ * Handle uncaught promise rejections and report to main process
52
+ */
53
+ process.on('unhandledRejection', (e) => {
54
+ process.send(
55
+ {
56
+ error: {
57
+ message: 'unhandledRejection: ' + e,
58
+ stack: typeof e.stack === 'string' ? e.stack : null,
59
+ },
60
+ },
61
+ sendHandle,
62
+ );
63
+ });
package/package.json CHANGED
@@ -1,63 +1,62 @@
1
1
  {
2
2
  "name": "@stencil/dev-server",
3
- "version": "0.0.19-1",
4
- "description": "Tiny LiveReload server that watches a single directory",
5
- "main": "dist/index.js",
6
- "bin": {
7
- "stencil-dev-server": "./bin/stencil-dev-server"
8
- },
9
- "scripts": {
10
- "dev": "tsc -w -p .",
11
- "build": "tsc -p .",
12
- "test": "jest --runInBand",
13
- "deploy": "npm run build && np"
14
- },
15
- "files": [
16
- "assets/",
17
- "bin/",
18
- "dist/",
19
- "LICENSE",
20
- "README.md"
3
+ "version": "5.0.0-alpha.2",
4
+ "description": "Development server for Stencil with DOM-based HMR",
5
+ "keywords": [
6
+ "dev server",
7
+ "hmr",
8
+ "hot module replacement",
9
+ "stencil",
10
+ "web components"
21
11
  ],
12
+ "homepage": "https://stenciljs.com/",
13
+ "license": "MIT",
14
+ "author": "StencilJs Contributors",
22
15
  "repository": {
23
16
  "type": "git",
24
- "url": "git+https://github.com/ionic-team/stencil-dev-server.git"
17
+ "url": "git+https://github.com/stenciljs/core.git"
25
18
  },
26
- "author": "Ionic Team",
27
- "license": "MIT",
28
- "bugs": {
29
- "url": "https://github.com/ionic-team/stencil-dev-server/issues"
19
+ "files": [
20
+ "dist/",
21
+ "templates/",
22
+ "static/"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.mjs",
26
+ "types": "./dist/index.d.mts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.mts",
30
+ "import": "./dist/index.mjs"
31
+ },
32
+ "./client": {
33
+ "types": "./dist/client/index.d.mts",
34
+ "import": "./dist/client/index.mjs"
35
+ }
30
36
  },
31
- "homepage": "https://github.com/ionic-team/stencil-dev-server#readme",
32
37
  "dependencies": {
33
- "@ionic/discover": "^0.3.3",
34
- "chokidar": "^1.7.0",
35
- "devcert-san": "^0.3.3",
36
- "ecstatic": "^2.2.1",
37
- "opn": "^5.1.0",
38
- "tiny-lr": "^1.0.5"
38
+ "launch-editor": "^2.9.1",
39
+ "open": "^11.0.0",
40
+ "ws": "^8.0.0"
39
41
  },
40
42
  "devDependencies": {
41
- "@types/chokidar": "^1.7.0",
42
- "@types/jest": "^21.1.2",
43
- "@types/opn": "^3.0.28",
44
- "@types/supertest": "^2.0.3",
45
- "jest": "^21.2.1",
46
- "np": "^2.16.0",
47
- "supertest": "^3.0.0",
48
- "typescript": "^2.4.1"
43
+ "@tsdown/css": "^0.21.6",
44
+ "@types/ws": "^8.0.0",
45
+ "tsdown": "^0.21.6",
46
+ "typescript": "~6.0.2",
47
+ "vitest": "^4.1.1",
48
+ "vitest-environment-stencil": "^1.9.3",
49
+ "@stencil/core": "5.0.0-alpha.2"
49
50
  },
50
- "jest": {
51
- "moduleFileExtensions": [
52
- "ts",
53
- "tsx",
54
- "js"
55
- ],
56
- "transform": {
57
- "^.+\\.(ts|tsx)$": "<rootDir>/preprocessor.js"
58
- },
59
- "testMatch": [
60
- "**/__tests__/*.(ts|tsx|js)"
61
- ]
51
+ "peerDependencies": {
52
+ "@stencil/core": "^5.0.0-0"
53
+ },
54
+ "volta": {
55
+ "extends": "../../package.json"
56
+ },
57
+ "scripts": {
58
+ "build": "tsdown",
59
+ "test": "vitest run",
60
+ "typecheck": "tsc --noEmit"
62
61
  }
63
- }
62
+ }
Binary file