nitro-drizzle 0.2.11 → 0.2.13
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/README.md +3 -3
- package/dist/config/defineConfig.d.mts +1 -1
- package/dist/config/defineConfig.mjs +1 -1
- package/dist/config/defineConfig.mjs.map +1 -1
- package/dist/context/internal/templates.mjs +1 -1
- package/dist/context/internal/templates.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/module.d.mts +7 -2
- package/dist/module.mjs +10 -6
- package/dist/module.mjs.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -37,14 +37,14 @@ npm install @cloudflare/workers-types
|
|
|
37
37
|
|
|
38
38
|
### 1. Configure Nitro Module
|
|
39
39
|
|
|
40
|
-
Add `nitro-drizzle
|
|
40
|
+
Add `nitro-drizzle` to your `nitro.config.ts` modules:
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
43
|
// nitro.config.ts
|
|
44
44
|
import { defineNitroConfig } from "nitropack/config";
|
|
45
45
|
|
|
46
46
|
export default defineNitroConfig({
|
|
47
|
-
modules: ["nitro-drizzle
|
|
47
|
+
modules: ["nitro-drizzle"],
|
|
48
48
|
drizzle: {
|
|
49
49
|
datasources: {
|
|
50
50
|
content: { connector: "sqlite" },
|
|
@@ -175,7 +175,7 @@ const result = await myDatasource.database.select().from(myDatasource.schema.myT
|
|
|
175
175
|
|
|
176
176
|
### `defineConfig(config: DrizzleConfig, filename: string)`
|
|
177
177
|
|
|
178
|
-
- **Purpose**: Helper function to define Drizzle configuration files (`drizzle.config.ts`) that are compatible with both `nitro-drizzle
|
|
178
|
+
- **Purpose**: Helper function to define Drizzle configuration files (`drizzle.config.ts`) that are compatible with both `nitro-drizzle` and `drizzle-kit`. It handles path resolution automatically.
|
|
179
179
|
- **Parameters**:
|
|
180
180
|
- `config`: Your DrizzleKit configuration object.
|
|
181
181
|
- `filename`: Pass `import.meta.url` as the `filename` for correct relative path resolution.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config } from "drizzle-kit";
|
|
2
2
|
//#region src/config/defineConfig.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Define Drizzle config compatible with both 'nitro-drizzle
|
|
4
|
+
* Define Drizzle config compatible with both 'nitro-drizzle' and 'drizzle-kit' packages.
|
|
5
5
|
*
|
|
6
6
|
* @param config
|
|
7
7
|
* @param dirname
|
|
@@ -3,7 +3,7 @@ import { cwd } from "node:process";
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
//#region src/config/defineConfig.ts
|
|
5
5
|
/**
|
|
6
|
-
* Define Drizzle config compatible with both 'nitro-drizzle
|
|
6
|
+
* Define Drizzle config compatible with both 'nitro-drizzle' and 'drizzle-kit' packages.
|
|
7
7
|
*
|
|
8
8
|
* @param config
|
|
9
9
|
* @param dirname
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineConfig.mjs","names":["relativePath","resolvePath"],"sources":["../../src/config/defineConfig.ts"],"sourcesContent":["import type { Config as DrizzleConfig } from \"drizzle-kit\";\nimport { resolve as resolvePath, relative as relativePath } from \"pathe\";\nimport { cwd } from \"node:process\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Define Drizzle config compatible with both 'nitro-drizzle
|
|
1
|
+
{"version":3,"file":"defineConfig.mjs","names":["relativePath","resolvePath"],"sources":["../../src/config/defineConfig.ts"],"sourcesContent":["import type { Config as DrizzleConfig } from \"drizzle-kit\";\nimport { resolve as resolvePath, relative as relativePath } from \"pathe\";\nimport { cwd } from \"node:process\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Define Drizzle config compatible with both 'nitro-drizzle' and 'drizzle-kit' packages.\n *\n * @param config\n * @param dirname\n * @returns\n */\nexport function defineConfig(config: DrizzleConfig, filename: string) {\n const { schema, out, ...other } = config;\n\n const workingDir = cwd();\n\n const dirname = fileURLToPath(new URL(\".\", filename));\n\n return {\n schema: transformToPluginCompatiblePath(dirname, workingDir, schema),\n out: transformToPluginCompatiblePath(dirname, workingDir, out),\n ...other,\n };\n}\n\nfunction transformToPluginCompatiblePath(\n dirname: string,\n cwd: string,\n path: string | undefined,\n): string | undefined;\nfunction transformToPluginCompatiblePath(\n dirname: string,\n cwd: string,\n path: string | string[] | undefined,\n): string | string[] | undefined;\nfunction transformToPluginCompatiblePath(\n dirname: string,\n cwd: string,\n path: string | string[] | undefined,\n) {\n if (!path) return;\n if (Array.isArray(path)) {\n return path.flatMap((path) => transformToRelative(dirname, cwd, path));\n }\n return relativePath(cwd, resolvePath(dirname, path));\n}\n\nfunction transformToRelative(dirname: string, cwd: string, path: string) {\n path = resolvePath(dirname, path);\n return relativePath(cwd, path);\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,aAAa,QAAuB,UAAkB;CACpE,MAAM,EAAE,QAAQ,KAAK,GAAG,UAAU;CAElC,MAAM,aAAa,IAAI;CAEvB,MAAM,UAAU,cAAc,IAAI,IAAI,KAAK,QAAQ,CAAC;CAEpD,OAAO;EACL,QAAQ,gCAAgC,SAAS,YAAY,MAAM;EACnE,KAAK,gCAAgC,SAAS,YAAY,GAAG;EAC7D,GAAG;CACL;AACF;AAYA,SAAS,gCACP,SACA,KACA,MACA;CACA,IAAI,CAAC,MAAM;CACX,IAAI,MAAM,QAAQ,IAAI,GACpB,OAAO,KAAK,SAAS,SAAS,oBAAoB,SAAS,KAAK,IAAI,CAAC;CAEvE,OAAOA,SAAa,KAAKC,QAAY,SAAS,IAAI,CAAC;AACrD;AAEA,SAAS,oBAAoB,SAAiB,KAAa,MAAc;CACvE,OAAOA,QAAY,SAAS,IAAI;CAChC,OAAOD,SAAa,KAAK,IAAI;AAC/B"}
|
|
@@ -18,7 +18,7 @@ function genReference(reference) {
|
|
|
18
18
|
function moduleTypeDeclarations(datasources) {
|
|
19
19
|
if (!datasources.length) return {};
|
|
20
20
|
const names = datasources.map((d) => d.name);
|
|
21
|
-
const moduleId = "nitro-drizzle
|
|
21
|
+
const moduleId = "nitro-drizzle";
|
|
22
22
|
return { "nitro-drizzle/module.d.ts": [
|
|
23
23
|
genReference({ types: moduleId }),
|
|
24
24
|
genAugmentation(moduleId, { DatasourceOptions: [{}, { extends: `Record<${names.map((n) => genString(n)).join(" | ")}, { connector: string; }>` }] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.mjs","names":[],"sources":["../../../src/context/internal/templates.ts"],"sourcesContent":["import {\n genTypeImport,\n genAugmentation,\n genInlineTypeImport,\n genString,\n genExport,\n} from \"knitwork\";\nimport type { DatasourceInfo } from \"..\";\nimport type { VirtualModules } from \"nitro-drizzle/shared\";\n\nexport function runtimeDeclarations(datasources: readonly DatasourceInfo[]) {\n if (!datasources.length) {\n return \"\";\n }\n\n return [\n genTypeImport(\"nitro-drizzle/runtime\", [\"ToDatasourceProvider\"]),\n genAugmentation(\"nitro-drizzle/runtime\", {\n DatasourceRegistry: Object.fromEntries(\n datasources\n .filter((datasource) => {\n return datasource.enabled;\n })\n .map(({ name, imports }): [string, string] => {\n const schemaType = genSchemaType(imports.schema);\n const driverType = genInlineTypeImport(imports.connector);\n return [name, `${\"ToDatasourceProvider\"}<${schemaType}, ${driverType}<${schemaType}>>`];\n }),\n ),\n }),\n ].join(\"\\n\");\n}\n\nfunction genSchemaType(imports: string[]) {\n return imports.map((id) => `typeof import('${id}')`).join(\" & \");\n}\n\nexport type TypeReference = { types: string };\n\nexport type PathReference = { path: string };\n\nexport function genReference(reference: TypeReference | PathReference) {\n return /* ts */ `/// <reference ${Object.entries(reference)\n .map(([prop, value]) => `${prop}=\"${value}\"`)\n .join(\"\")} />`;\n}\n\nexport function moduleTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n): VirtualModules<`${string}.d.ts`> {\n if (!datasources.length) {\n return {};\n }\n\n const names = datasources.map((d) => d.name);\n\n const moduleId = \"nitro-drizzle
|
|
1
|
+
{"version":3,"file":"templates.mjs","names":[],"sources":["../../../src/context/internal/templates.ts"],"sourcesContent":["import {\n genTypeImport,\n genAugmentation,\n genInlineTypeImport,\n genString,\n genExport,\n} from \"knitwork\";\nimport type { DatasourceInfo } from \"..\";\nimport type { VirtualModules } from \"nitro-drizzle/shared\";\n\nexport function runtimeDeclarations(datasources: readonly DatasourceInfo[]) {\n if (!datasources.length) {\n return \"\";\n }\n\n return [\n genTypeImport(\"nitro-drizzle/runtime\", [\"ToDatasourceProvider\"]),\n genAugmentation(\"nitro-drizzle/runtime\", {\n DatasourceRegistry: Object.fromEntries(\n datasources\n .filter((datasource) => {\n return datasource.enabled;\n })\n .map(({ name, imports }): [string, string] => {\n const schemaType = genSchemaType(imports.schema);\n const driverType = genInlineTypeImport(imports.connector);\n return [name, `${\"ToDatasourceProvider\"}<${schemaType}, ${driverType}<${schemaType}>>`];\n }),\n ),\n }),\n ].join(\"\\n\");\n}\n\nfunction genSchemaType(imports: string[]) {\n return imports.map((id) => `typeof import('${id}')`).join(\" & \");\n}\n\nexport type TypeReference = { types: string };\n\nexport type PathReference = { path: string };\n\nexport function genReference(reference: TypeReference | PathReference) {\n return /* ts */ `/// <reference ${Object.entries(reference)\n .map(([prop, value]) => `${prop}=\"${value}\"`)\n .join(\"\")} />`;\n}\n\nexport function moduleTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n): VirtualModules<`${string}.d.ts`> {\n if (!datasources.length) {\n return {};\n }\n\n const names = datasources.map((d) => d.name);\n\n const moduleId = \"nitro-drizzle\";\n\n const content = [\n genReference({ types: moduleId }),\n genAugmentation(moduleId, {\n DatasourceOptions: [\n {},\n {\n extends: `Record<${names.map((n) => genString(n)).join(\" | \")}, { connector: string; }>`,\n },\n ],\n }),\n /* ts */ `export {};`,\n ].join(\"\\n\");\n\n return {\n \"nitro-drizzle/module.d.ts\": content,\n };\n}\n\nexport function dialectDeclarations(datasources: readonly DatasourceInfo[]) {\n return datasources\n .filter((d) => d.enabled)\n .map(({ name, dialect }) => {\n return /*ts*/ `\n declare module \"#nitro-drizzle/dialects/${name}\" {\n ${genExport(`nitro-drizzle/dialects/${dialect}`, \"*\")}\n }\n `;\n })\n .join(\"\\n\");\n}\n"],"mappings":";;AAUA,SAAgB,oBAAoB,aAAwC;CAC1E,IAAI,CAAC,YAAY,QACf,OAAO;CAGT,OAAO,CACL,cAAc,yBAAyB,CAAC,sBAAsB,CAAC,GAC/D,gBAAgB,yBAAyB,EACvC,oBAAoB,OAAO,YACzB,YACG,QAAQ,eAAe;EACtB,OAAO,WAAW;CACpB,CAAC,CAAC,CACD,KAAK,EAAE,MAAM,cAAgC;EAC5C,MAAM,aAAa,cAAc,QAAQ,MAAM;EAE/C,OAAO,CAAC,MAAM,wBAA6B,WAAW,IADnC,oBAAoB,QAAQ,SACoB,EAAE,GAAG,WAAW,GAAG;CACxF,CAAC,CACL,EACF,CAAC,CACH,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAS,cAAc,SAAmB;CACxC,OAAO,QAAQ,KAAK,OAAO,kBAAkB,GAAG,GAAG,CAAC,CAAC,KAAK,KAAK;AACjE;AAMA,SAAgB,aAAa,WAA0C;CACrE,OAAgB,kBAAkB,OAAO,QAAQ,SAAS,CAAC,CACxD,KAAK,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,MAAM,EAAE,CAAC,CAC5C,KAAK,EAAE,EAAE;AACd;AAEA,SAAgB,uBACd,aACkC;CAClC,IAAI,CAAC,YAAY,QACf,OAAO,CAAC;CAGV,MAAM,QAAQ,YAAY,KAAK,MAAM,EAAE,IAAI;CAE3C,MAAM,WAAW;CAejB,OAAO,EACL,6BAdc;EACd,aAAa,EAAE,OAAO,SAAS,CAAC;EAChC,gBAAgB,UAAU,EACxB,mBAAmB,CACjB,CAAC,GACD,EACE,SAAS,UAAU,MAAM,KAAK,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,2BAChE,CACF,EACF,CAAC;EACQ;CACX,CAAC,CAAC,KAAK,IAG8B,EACrC;AACF;AAEA,SAAgB,oBAAoB,aAAwC;CAC1E,OAAO,YACJ,QAAQ,MAAM,EAAE,OAAO,CAAC,CACxB,KAAK,EAAE,MAAM,cAAc;EAC1B,OAAc;kDAC8B,KAAK;YAC3C,UAAU,0BAA0B,WAAW,GAAG,EAAE;;;CAG5D,CAAC,CAAC,CACD,KAAK,IAAI;AACd"}
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/dist/module.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ import { NitroModule } from "nitropack/types";
|
|
|
10
10
|
interface DatasourceOptions {}
|
|
11
11
|
declare module "nitropack/types" {
|
|
12
12
|
interface NitroOptions {
|
|
13
|
-
drizzle
|
|
13
|
+
drizzle?: ModuleOptions;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
interface ModuleOptions {
|
|
@@ -28,15 +28,20 @@ interface ModuleOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
migrations?: false | Partial<MigrationOptions>;
|
|
30
30
|
}
|
|
31
|
+
type ModuleConfig = Required<ModuleOptions> & {
|
|
32
|
+
migrations: false | Required<MigrationOptions>;
|
|
33
|
+
};
|
|
31
34
|
declare function createDefaultOptions(): {
|
|
32
35
|
readonly baseDir: "~/drizzle";
|
|
33
36
|
readonly configPattern: readonly ["drizzle.config.{js,ts}", "drizzle-*.config.{js,ts}"];
|
|
37
|
+
readonly datasources: {};
|
|
34
38
|
readonly migrations: {
|
|
35
39
|
readonly storageBase: "drizzle:migrations";
|
|
36
40
|
readonly migrateOnInit: false;
|
|
37
41
|
};
|
|
38
42
|
};
|
|
43
|
+
declare function defineModuleConfig(options?: ModuleOptions): ModuleConfig;
|
|
39
44
|
declare const module: NitroModule;
|
|
40
45
|
//#endregion
|
|
41
|
-
export { DatasourceOptions, ModuleOptions, addInlineExternals, createDefaultOptions, module as default, updateServerAssets };
|
|
46
|
+
export { DatasourceOptions, ModuleConfig, ModuleOptions, addInlineExternals, createDefaultOptions, module as default, defineModuleConfig, updateServerAssets };
|
|
42
47
|
//# sourceMappingURL=module.d.mts.map
|
package/dist/module.mjs
CHANGED
|
@@ -14,26 +14,30 @@ function createDefaultOptions() {
|
|
|
14
14
|
return {
|
|
15
15
|
baseDir: "~/drizzle",
|
|
16
16
|
configPattern: ["drizzle.config.{js,ts}", "drizzle-*.config.{js,ts}"],
|
|
17
|
+
datasources: {},
|
|
17
18
|
migrations: {
|
|
18
19
|
storageBase: "drizzle:migrations",
|
|
19
20
|
migrateOnInit: false
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
}
|
|
24
|
+
function defineModuleConfig(options) {
|
|
25
|
+
return defu(options, createDefaultOptions());
|
|
26
|
+
}
|
|
23
27
|
const module = {
|
|
24
28
|
name: pkgName,
|
|
25
29
|
async setup(nitro) {
|
|
26
|
-
const
|
|
30
|
+
const moduleConfig = defineModuleConfig(nitro.options.drizzle);
|
|
27
31
|
const resolver = createResolver(nitro.options.rootDir, { alias: nitro.options.alias });
|
|
28
|
-
const baseDir = resolve(nitro.options.srcDir, resolveAlias(
|
|
32
|
+
const baseDir = resolve(nitro.options.srcDir, resolveAlias(moduleConfig.baseDir, nitro.options.alias));
|
|
29
33
|
const context = createContext({
|
|
30
34
|
cwd: process.cwd(),
|
|
31
35
|
resolver,
|
|
32
36
|
baseDir,
|
|
33
37
|
logger: nitro.logger,
|
|
34
|
-
configPattern:
|
|
35
|
-
datasource: { ...
|
|
36
|
-
migrations:
|
|
38
|
+
configPattern: moduleConfig.configPattern,
|
|
39
|
+
datasource: { ...moduleConfig.datasources },
|
|
40
|
+
migrations: moduleConfig.migrations || void 0,
|
|
37
41
|
tasks: nitro.options.experimental.tasks ? (tasks) => {
|
|
38
42
|
nitro.options.tasks ||= {};
|
|
39
43
|
Object.assign(nitro.options.tasks, tasks);
|
|
@@ -68,6 +72,6 @@ const module = {
|
|
|
68
72
|
}
|
|
69
73
|
};
|
|
70
74
|
//#endregion
|
|
71
|
-
export { addInlineExternals, createDefaultOptions, module as default, updateServerAssets };
|
|
75
|
+
export { addInlineExternals, createDefaultOptions, module as default, defineModuleConfig, updateServerAssets };
|
|
72
76
|
|
|
73
77
|
//# sourceMappingURL=module.mjs.map
|
package/dist/module.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":[],"sources":["../src/module/index.ts"],"sourcesContent":["import type { NitroModule } from \"nitropack/types\";\nimport { defu } from \"defu\";\nimport { resolve } from \"pathe\";\nimport { resolveAlias } from \"pathe/utils\";\n\nimport {\n createContext,\n type ConfigPattern,\n type ContextOptions,\n type MigrationOptions,\n} from \"nitro-drizzle/context\";\nimport type { VirtualModules, MaybePromise } from \"nitro-drizzle/shared\";\nimport { pkgName } from \"nitro-drizzle/meta\";\n\nimport { updateServerAssets } from \"./utils/assets\";\nimport { addInlineExternals } from \"./utils/externals\";\n\nimport { addAugmentations, addDeclarations } from \"./internal/types\";\nimport { createResolver } from \"./internal/resolver\";\nimport { reloadPlugin } from \"./internal/reload\";\nimport { addPlugin } from \"./internal/rollup\";\n\n/**\n * Datasource-specific configuration options.\n * This interface is augmented by the module with connector-specific options.\n */\nexport interface DatasourceOptions {\n // augmented by module\n}\n\ndeclare module \"nitropack/types\" {\n interface NitroOptions {\n drizzle
|
|
1
|
+
{"version":3,"file":"module.mjs","names":[],"sources":["../src/module/index.ts"],"sourcesContent":["import type { NitroModule } from \"nitropack/types\";\nimport { defu } from \"defu\";\nimport { resolve } from \"pathe\";\nimport { resolveAlias } from \"pathe/utils\";\n\nimport {\n createContext,\n type ConfigPattern,\n type ContextOptions,\n type MigrationOptions,\n} from \"nitro-drizzle/context\";\nimport type { VirtualModules, MaybePromise } from \"nitro-drizzle/shared\";\nimport { pkgName } from \"nitro-drizzle/meta\";\n\nimport { updateServerAssets } from \"./utils/assets\";\nimport { addInlineExternals } from \"./utils/externals\";\n\nimport { addAugmentations, addDeclarations } from \"./internal/types\";\nimport { createResolver } from \"./internal/resolver\";\nimport { reloadPlugin } from \"./internal/reload\";\nimport { addPlugin } from \"./internal/rollup\";\n\n/**\n * Datasource-specific configuration options.\n * This interface is augmented by the module with connector-specific options.\n */\nexport interface DatasourceOptions {\n // augmented by module\n}\n\ndeclare module \"nitropack/types\" {\n interface NitroOptions {\n drizzle?: ModuleOptions;\n }\n}\n\nexport interface ModuleOptions {\n /**\n * Directory to search datasources\n */\n baseDir?: string;\n /**\n * Patterns to search Drizzle configs\n */\n configPattern?: ConfigPattern;\n\n datasources?: DatasourceOptions;\n\n /**\n * Enable migrations storage\n */\n migrations?: false | Partial<MigrationOptions>;\n}\n\nexport type ModuleConfig = Required<ModuleOptions> & {\n migrations: false | Required<MigrationOptions>;\n};\n\nexport function createDefaultOptions() {\n return {\n baseDir: \"~/drizzle\",\n configPattern: [\"drizzle.config.{js,ts}\", \"drizzle-*.config.{js,ts}\"],\n datasources: {},\n migrations: {\n storageBase: \"drizzle:migrations\",\n migrateOnInit: false,\n },\n } as const satisfies ModuleConfig;\n}\n\nexport function defineModuleConfig(options?: ModuleOptions): ModuleConfig {\n return defu(options, createDefaultOptions());\n}\n\nconst module: NitroModule = {\n name: pkgName,\n async setup(nitro) {\n const moduleConfig = defineModuleConfig(nitro.options.drizzle);\n\n const resolver = createResolver(nitro.options.rootDir, {\n alias: nitro.options.alias,\n });\n\n const baseDir = resolve(\n nitro.options.srcDir,\n resolveAlias(moduleConfig.baseDir, nitro.options.alias),\n );\n\n const contextOptions: ContextOptions = {\n cwd: process.cwd(),\n resolver: resolver,\n baseDir,\n logger: nitro.logger,\n configPattern: moduleConfig.configPattern,\n datasource: { ...moduleConfig.datasources },\n migrations: moduleConfig.migrations || void 0,\n\n tasks: nitro.options.experimental.tasks\n ? (tasks) => {\n nitro.options.tasks ||= {};\n Object.assign(nitro.options.tasks, tasks);\n }\n : void 0,\n\n plugins(plugins) {\n nitro.options.plugins.push(...plugins);\n },\n\n virtualModules(modules: VirtualModules): MaybePromise<void> {\n Object.assign(nitro.options.virtual, modules);\n },\n\n declarations(declarations): MaybePromise<void> {\n nitro.hooks.hook(\"types:extend\", async (types) => {\n await addAugmentations(nitro.options, types, {\n ...declarations.runtime,\n ...declarations.module,\n });\n\n await addDeclarations(nitro.options, types, declarations.virtual);\n });\n },\n\n assets(assets) {\n updateServerAssets(nitro.options, assets);\n },\n\n inlineExternals(modules: readonly string[]) {\n addInlineExternals(nitro.options, modules);\n },\n };\n\n const context = createContext(contextOptions);\n\n // auto-imports\n if (nitro.options.imports) {\n nitro.options.imports.imports ||= [];\n\n // TODO\n // nitro.options.imports.imports.push({\n // name: 'useMigrations',\n // as: 'useDrizzleMigrations',\n // from: 'nitro-drizzle/runtime',\n // })\n }\n\n nitro.hooks.hook(\"rollup:before\", async (nitro, config) => {\n await addPlugin(config, reloadPlugin(nitro, { baseDir }));\n });\n\n await context.init();\n },\n};\n\nexport default module;\n\nexport { addInlineExternals, updateServerAssets };\n"],"mappings":";;;;;;;;;;;;AA0DA,SAAgB,uBAAuB;CACrC,OAAO;EACL,SAAS;EACT,eAAe,CAAC,0BAA0B,0BAA0B;EACpE,aAAa,CAAC;EACd,YAAY;GACV,aAAa;GACb,eAAe;EACjB;CACF;AACF;AAEA,SAAgB,mBAAmB,SAAuC;CACxE,OAAO,KAAK,SAAS,qBAAqB,CAAC;AAC7C;AAEA,MAAM,SAAsB;CAC1B,MAAM;CACN,MAAM,MAAM,OAAO;EACjB,MAAM,eAAe,mBAAmB,MAAM,QAAQ,OAAO;EAE7D,MAAM,WAAW,eAAe,MAAM,QAAQ,SAAS,EACrD,OAAO,MAAM,QAAQ,MACvB,CAAC;EAED,MAAM,UAAU,QACd,MAAM,QAAQ,QACd,aAAa,aAAa,SAAS,MAAM,QAAQ,KAAK,CACxD;EA8CA,MAAM,UAAU,cAAc;GA3C5B,KAAK,QAAQ,IAAI;GACP;GACV;GACA,QAAQ,MAAM;GACd,eAAe,aAAa;GAC5B,YAAY,EAAE,GAAG,aAAa,YAAY;GAC1C,YAAY,aAAa,cAAc,KAAK;GAE5C,OAAO,MAAM,QAAQ,aAAa,SAC7B,UAAU;IACT,MAAM,QAAQ,UAAU,CAAC;IACzB,OAAO,OAAO,MAAM,QAAQ,OAAO,KAAK;GAC1C,IACA,KAAK;GAET,QAAQ,SAAS;IACf,MAAM,QAAQ,QAAQ,KAAK,GAAG,OAAO;GACvC;GAEA,eAAe,SAA6C;IAC1D,OAAO,OAAO,MAAM,QAAQ,SAAS,OAAO;GAC9C;GAEA,aAAa,cAAkC;IAC7C,MAAM,MAAM,KAAK,gBAAgB,OAAO,UAAU;KAChD,MAAM,iBAAiB,MAAM,SAAS,OAAO;MAC3C,GAAG,aAAa;MAChB,GAAG,aAAa;KAClB,CAAC;KAED,MAAM,gBAAgB,MAAM,SAAS,OAAO,aAAa,OAAO;IAClE,CAAC;GACH;GAEA,OAAO,QAAQ;IACb,mBAAmB,MAAM,SAAS,MAAM;GAC1C;GAEA,gBAAgB,SAA4B;IAC1C,mBAAmB,MAAM,SAAS,OAAO;GAC3C;EAGyC,CAAC;EAG5C,IAAI,MAAM,QAAQ,SAChB,MAAM,QAAQ,QAAQ,YAAY,CAAC;EAUrC,MAAM,MAAM,KAAK,iBAAiB,OAAO,OAAO,WAAW;GACzD,MAAM,UAAU,QAAQ,aAAa,OAAO,EAAE,QAAQ,CAAC,CAAC;EAC1D,CAAC;EAED,MAAM,QAAQ,KAAK;CACrB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-drizzle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Nitro module to integrate Drizzle ORM with ease.",
|
|
5
5
|
"homepage": "https://github.com/Myshkouski/nitro-drizzle#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"type": "module",
|
|
19
19
|
"exports": {
|
|
20
|
+
".": "./dist/index.mjs",
|
|
20
21
|
"./shared": "./dist/shared.mjs",
|
|
21
22
|
"./migrations": "./dist/migrations.mjs",
|
|
22
23
|
"./migrations/task": "./dist/migrations/task.mjs",
|