rebuildjs 0.21.0 → 0.22.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/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -3
- package/css/index.d.ts +0 -3
- package/css/index.js +0 -35
- package/css/index.test.ts +0 -34
package/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './app/index.js'
|
|
|
4
4
|
export * from './asset/index.js'
|
|
5
5
|
export * from './browser/index.js'
|
|
6
6
|
export * from './build/index.js'
|
|
7
|
-
export * from './css/index.js'
|
|
8
7
|
export * from './ctx/index.js'
|
|
9
8
|
export * from './metafile/index.js'
|
|
10
9
|
export * from './middleware/index.js'
|
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export * from './app/index.js'
|
|
|
4
4
|
export * from './asset/index.js'
|
|
5
5
|
export * from './browser/index.js'
|
|
6
6
|
export * from './build/index.js'
|
|
7
|
-
export * from './css/index.js'
|
|
8
7
|
export * from './ctx/index.js'
|
|
9
8
|
export * from './metafile/index.js'
|
|
10
9
|
export * from './middleware/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"asset",
|
|
31
31
|
"browser",
|
|
32
32
|
"build",
|
|
33
|
-
"css",
|
|
34
33
|
"ctx",
|
|
35
34
|
"metafile",
|
|
36
35
|
"middleware",
|
|
@@ -43,7 +42,6 @@
|
|
|
43
42
|
"./asset": "./asset/index.js",
|
|
44
43
|
"./browser": "./browser/index.js",
|
|
45
44
|
"./build": "./build/index.js",
|
|
46
|
-
"./css": "./css/index.js",
|
|
47
45
|
"./ctx": "./ctx/index.js",
|
|
48
46
|
"./metafile": "./metafile/index.js",
|
|
49
47
|
"./middleware": "./middleware/index.js",
|
package/css/index.d.ts
DELETED
package/css/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="esbuild" />
|
|
2
|
-
/// <reference types="./index.d.ts" />
|
|
3
|
-
/**
|
|
4
|
-
* @returns {Plugin}
|
|
5
|
-
* @private
|
|
6
|
-
*/
|
|
7
|
-
export function cssjs_esbuild_plugin_() {
|
|
8
|
-
return {
|
|
9
|
-
name: 'cssjs_esbuild_plugin',
|
|
10
|
-
setup(build) {
|
|
11
|
-
build.onLoad(
|
|
12
|
-
{ filter: /\.css\.(js|ts)$/ },
|
|
13
|
-
async ({ path })=>{
|
|
14
|
-
const contents = await import(path).then(mod=>mod.default())
|
|
15
|
-
return { contents, loader: 'css' }
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @param {string}css
|
|
23
|
-
* @param {Record<string, string>}_var_R_a
|
|
24
|
-
* @returns {string}
|
|
25
|
-
*/
|
|
26
|
-
export function var__css__replace(css, ..._var_R_a) {
|
|
27
|
-
const var_R = _var_R_a.reduce((
|
|
28
|
-
var_R,
|
|
29
|
-
_var_R
|
|
30
|
-
)=>({
|
|
31
|
-
...var_R,
|
|
32
|
-
..._var_R,
|
|
33
|
-
}), {})
|
|
34
|
-
return css.replaceAll(/var\(([^)]*)\)/g, (_, $)=>var_R[$])
|
|
35
|
-
}
|
package/css/index.test.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { build } from 'esbuild'
|
|
2
|
-
import { dirname, join } from 'path'
|
|
3
|
-
import { test } from 'uvu'
|
|
4
|
-
import { equal } from 'uvu/assert'
|
|
5
|
-
import { app_ctx } from '../ctx/index.js'
|
|
6
|
-
import { cssjs_esbuild_plugin_, var__css__replace } from './index.js'
|
|
7
|
-
test.after.each(()=>{
|
|
8
|
-
app_ctx.s.app.clear()
|
|
9
|
-
})
|
|
10
|
-
test('var__css__replace', ()=>{
|
|
11
|
-
equal(var__css__replace(
|
|
12
|
-
`div { color: var(--color); font-size: var(--font-size); }`,
|
|
13
|
-
{ '--color': 'red' },
|
|
14
|
-
{ '--font-size': '16px' }
|
|
15
|
-
),
|
|
16
|
-
`div { color: red; font-size: 16px; }`)
|
|
17
|
-
})
|
|
18
|
-
test('cssjs_esbuild_plugin_', async ()=>{
|
|
19
|
-
// stdin config does not with onLoad
|
|
20
|
-
// see https://github.com/evanw/esbuild/issues/720
|
|
21
|
-
const result = await build({
|
|
22
|
-
entryPoints: [join(dirname(new URL(import.meta.url).pathname), '../_fixtures/index.css.ts')],
|
|
23
|
-
plugins: [cssjs_esbuild_plugin_()],
|
|
24
|
-
write: false,
|
|
25
|
-
})
|
|
26
|
-
equal(result.outputFiles.map(outputFile=>new TextDecoder().decode(outputFile.contents)), [
|
|
27
|
-
`div {
|
|
28
|
-
color: var(--color);
|
|
29
|
-
font-size: var(--font-size);
|
|
30
|
-
}
|
|
31
|
-
`
|
|
32
|
-
])
|
|
33
|
-
})
|
|
34
|
-
test.run()
|