instaserve 0.0.23 → 0.0.26

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/components.mjs ADDED
@@ -0,0 +1,5 @@
1
+ export default {
2
+ 'h-w': {
3
+ template: 'Hello world'
4
+ }
5
+ }
package/index.html CHANGED
@@ -1,6 +1,7 @@
1
- <!DOCTYPE html>
2
-
3
- <script>navigator.serviceWorker.register('sw.js')</script>
4
- <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css'>
5
-
1
+ <!DOCTYPE html>
2
+
3
+ <script>navigator.serviceWorker.register('sw.js')</script>
4
+ <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css'>
5
+ <script src='https://unpkg.com/enigmatic/enigmatic.js'></script>
6
+
6
7
  <div class='bg-yellow-200'>hello</div>
package/index.mjs CHANGED
@@ -11,17 +11,19 @@ const indexfile = resolve('index.html')
11
11
  console.log(routesfile, routesurl)
12
12
 
13
13
  if (!fs.existsSync(routesfile)) {
14
- fs.writeFileSync(routesfile, `export default {
15
- _debug: ({ r, s, db }) => console.log(r.url, r.method),
16
- '/': ({ s }) => s.endJSON({ message: 'hello index' }),
17
- 'tables': name => ([k, v]) => k.match(name + ':')
18
- }`)
14
+ fs.writeFileSync(routesfile, `import fs from 'node:fs'
15
+ export default {
16
+ _debug: ({ r, s, db }) => console.log(r.url, r.method),
17
+ '/': ({ s }) => s.end(fs.readFileSync('index.html', 'utf-8')),
18
+ 'tables': name => ([k, v]) => k.match(name + ':')
19
+ }`)
19
20
  }
20
21
  if (!fs.existsSync(indexfile)) {
21
22
  fs.writeFileSync(indexfile, `<!DOCTYPE html>
22
23
 
23
24
  <script>navigator.serviceWorker.register('sw.js')</script>
24
25
  <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css'>
26
+ <script src='https://unpkg.com/enigmatic/enigmatic.js'></script>
25
27
 
26
28
  <div class='bg-yellow-200'>hello</div>`)
27
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instaserve",
3
- "version": "0.0.23",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "bin": "./index.mjs"
package/routes.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  _debug: ({ r, s, db }) => console.log(r.url, r.method),
3
- '/': ({ s }) => s.endJSON({ message: 'hello index' }),
3
+ '/': ({ s }) => s.end(fs.readFileSync('index.html', 'utf-8')),
4
4
  'tables': name => ([k, v]) => k.match(`${name}:`)
5
5
  }