@astrojs/db 0.1.5 → 0.1.6

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.
@@ -3,7 +3,7 @@ import { vitePluginInjectEnvTs } from "./vite-plugin-inject-env-ts.js";
3
3
  import { typegen } from "./typegen.js";
4
4
  import { existsSync } from "fs";
5
5
  import { mkdir, rm, writeFile } from "fs/promises";
6
- import { getLocalDbUrl } from "./consts.js";
6
+ import { getLocalDbUrl, DB_PATH } from "./consts.js";
7
7
  import { createLocalDatabaseClient, setupDbTables } from "./internal.js";
8
8
  import { astroConfigWithDbSchema } from "./config.js";
9
9
  import { getAstroStudioEnv } from "./utils.js";
@@ -65,6 +65,7 @@ function integration() {
65
65
  }
66
66
  updateConfig({
67
67
  vite: {
68
+ assetsInclude: [DB_PATH],
68
69
  plugins: [dbPlugin, vitePluginInjectEnvTs(config)]
69
70
  }
70
71
  });
@@ -1,4 +1,5 @@
1
1
  import { DRIZZLE_MOD_IMPORT, INTERNAL_MOD_IMPORT, VIRTUAL_MODULE_ID, DB_PATH } from "./consts.js";
2
+ import fs from "node:fs";
2
3
  const resolvedVirtualModuleId = "\0" + VIRTUAL_MODULE_ID;
3
4
  function vitePluginDb(params) {
4
5
  return {
@@ -16,6 +17,16 @@ function vitePluginDb(params) {
16
17
  return getStudioVirtualModContents(params);
17
18
  }
18
19
  return getVirtualModContents(params);
20
+ },
21
+ async buildEnd() {
22
+ if ("dbUrl" in params) {
23
+ const data = await fs.promises.readFile(new URL(params.dbUrl));
24
+ this.emitFile({
25
+ fileName: "content.db",
26
+ source: data,
27
+ type: "asset"
28
+ });
29
+ }
19
30
  }
20
31
  };
21
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/db",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -61,8 +61,8 @@
61
61
  "mocha": "^10.2.0",
62
62
  "typescript": "^5.2.2",
63
63
  "vite": "^4.4.11",
64
- "astro-scripts": "0.0.14",
65
- "astro": "4.2.4"
64
+ "astro": "4.2.4",
65
+ "astro-scripts": "0.0.14"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "astro-scripts build \"src/**/*.ts\" && tsc",