coralite-scripts 0.28.2 → 0.28.3
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/bin/index.js +2 -1
- package/dist/libs/config.d.ts +0 -3
- package/dist/libs/config.d.ts.map +1 -1
- package/libs/config.js +9 -0
- package/libs/server.js +13 -7
- package/package.json +2 -2
package/bin/index.js
CHANGED
package/dist/libs/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../libs/config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../libs/config.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,sCArBW,oBAAoB,GAClB,oBAAoB,CA2HhC;0CAtIsC,mBAAmB"}
|
package/libs/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {CoraliteScriptConfig} from '../types/index.js'
|
|
3
3
|
*/
|
|
4
|
+
import { staticAssetPlugin } from 'coralite/plugins'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Defines the Coralite configuration for the project.
|
|
@@ -123,5 +124,13 @@ export function defineConfig (options) {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
if (options.assets) {
|
|
128
|
+
if (!Array.isArray(options.assets)) {
|
|
129
|
+
throw new Error('Configuration "assets" must be an array')
|
|
130
|
+
}
|
|
131
|
+
options.plugins = options.plugins || []
|
|
132
|
+
options.plugins.push(staticAssetPlugin(options.assets))
|
|
133
|
+
}
|
|
134
|
+
|
|
126
135
|
return options
|
|
127
136
|
}
|
package/libs/server.js
CHANGED
|
@@ -39,7 +39,8 @@ async function server (config, options) {
|
|
|
39
39
|
plugins: config.plugins,
|
|
40
40
|
ignoreByAttribute: config.ignoreByAttribute,
|
|
41
41
|
skipRenderByAttribute: config.skipRenderByAttribute,
|
|
42
|
-
mode: 'development'
|
|
42
|
+
mode: 'development',
|
|
43
|
+
output: config.output
|
|
43
44
|
})
|
|
44
45
|
await coralite.initialise()
|
|
45
46
|
displaySuccess('Coralite initialized successfully')
|
|
@@ -86,10 +87,17 @@ async function server (config, options) {
|
|
|
86
87
|
next()
|
|
87
88
|
})
|
|
88
89
|
|
|
90
|
+
const staticOptions = {
|
|
91
|
+
cacheControl: false,
|
|
92
|
+
setHeaders: (res, path) => {
|
|
93
|
+
if (path.endsWith('.wasm')) {
|
|
94
|
+
res.setHeader('Content-Type', 'application/wasm')
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
89
99
|
// serve compiled components directory
|
|
90
|
-
app.use(express.static(config.output,
|
|
91
|
-
cacheControl: false
|
|
92
|
-
}))
|
|
100
|
+
app.use(express.static(config.output, staticOptions))
|
|
93
101
|
|
|
94
102
|
// check if Sass is configured and add its input directory to watchPath for file changes.
|
|
95
103
|
if (config.styles) {
|
|
@@ -139,9 +147,7 @@ async function server (config, options) {
|
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
app
|
|
142
|
-
.use(express.static(config.public,
|
|
143
|
-
cacheControl: false
|
|
144
|
-
}))
|
|
150
|
+
.use(express.static(config.public, staticOptions))
|
|
145
151
|
.get('/_/rebuild', (req, res) => {
|
|
146
152
|
// set headers for SSE
|
|
147
153
|
res.writeHead(200, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coralite-scripts",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.3",
|
|
4
4
|
"description": "Configuration and scripts for Create Coralite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"portfinder": "^1.0.38",
|
|
59
59
|
"postcss": "^8.5.6",
|
|
60
60
|
"sass": "^1.91.0",
|
|
61
|
-
"coralite": "0.28.
|
|
61
|
+
"coralite": "0.28.2"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "premove dist && pnpm build-types",
|