rebuildjs 0.4.1 → 0.5.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/browser/index.js CHANGED
@@ -1,6 +1,9 @@
1
+ import { file_exists_ } from '@ctx-core/fs'
1
2
  import { nullish__none_, tup } from 'ctx-core/function'
2
3
  import { be_memo_pair_, be_sig_triple_ } from 'ctx-core/rmemo'
3
- import { browser_relative_path_ } from '../app/index.js'
4
+ import { readFile } from 'fs/promises'
5
+ import { join } from 'path'
6
+ import { browser_path_, browser_relative_path_ } from '../app/index.js'
4
7
  import { app_ctx__be_config, middleware_ctx__be_config } from '../ctx/index.js'
5
8
  import { server__input_path_ } from '../server/index.js'
6
9
  export const [
@@ -9,6 +12,15 @@ export const [
9
12
  browser__metafile__set
10
13
  ] = be_sig_triple_(()=>
11
14
  undefined,
15
+ async (ctx, browser__metafile$)=>{
16
+ let metafile_path
17
+ if (
18
+ !browser__metafile$.lock
19
+ && await file_exists_(metafile_path = join(browser_path_(ctx), 'metafile.json'))
20
+ ) {
21
+ browser__metafile$._ = JSON.parse(await readFile(metafile_path).then(buf=>buf.toString()))
22
+ }
23
+ },
12
24
  { ...app_ctx__be_config, id: 'browser__metafile' })
13
25
  export const [
14
26
  browser__input_path$_,
package/build/index.js CHANGED
@@ -56,6 +56,7 @@ export async function server__build(config = {}) {
56
56
  } else {
57
57
  const esbuild_ctx = await context(esbuild_config)
58
58
  await esbuild_ctx.watch()
59
+ console.log('server__build|watch')
59
60
  }
60
61
  }
61
62
  /**
@@ -101,6 +102,7 @@ export async function browser__build(config = {}) {
101
102
  } else {
102
103
  const esbuild_ctx = await context(esbuild_config)
103
104
  await esbuild_ctx.watch()
105
+ console.log('browser__build|watch')
104
106
  }
105
107
  await public__cp()
106
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rebuildjs",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
5
5
  "keywords": [
6
6
  "reactive",
@@ -45,7 +45,7 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "dependencies": {
48
- "ctx-core": "^4.16.0",
48
+ "ctx-core": "^4.17.0",
49
49
  "elysia": "^0.7.30",
50
50
  "esbuild": "^0.19.9",
51
51
  "fdir": "^6.1.1",
package/server/index.js CHANGED
@@ -1,5 +1,7 @@
1
+ import { file_exists_ } from 'ctx-core/fs'
1
2
  import { nullish__none_, tup } from 'ctx-core/function'
2
- import { be_memo_pair_, be_sig_triple_ } from 'ctx-core/rmemo'
3
+ import { be_lock_memosig_triple_, be_memo_pair_, be_sig_triple_ } from 'ctx-core/rmemo'
4
+ import { readFile } from 'fs/promises'
3
5
  import { join } from 'path'
4
6
  import { cwd_, server_path_ } from '../app/index.js'
5
7
  import { middleware_ctx__be_config } from '../ctx/index.js'
@@ -7,8 +9,17 @@ export const [
7
9
  server__metafile$_,
8
10
  server__metafile_,
9
11
  server__metafile__set
10
- ] = be_sig_triple_(()=>
12
+ ] = be_lock_memosig_triple_(()=>
11
13
  undefined,
14
+ async (ctx, server__metafile$)=>{
15
+ let metafile_path
16
+ if (
17
+ !server__metafile$.lock
18
+ && await file_exists_(metafile_path = join(server_path_(ctx), 'metafile.json'))
19
+ ) {
20
+ server__metafile$._ = JSON.parse(await readFile(metafile_path).then(buf=>buf.toString()))
21
+ }
22
+ },
12
23
  { ...middleware_ctx__be_config, id: 'server__metafile' })
13
24
  export const [
14
25
  server__input_path$_,