vite-plugin-neon-new 0.8.0 → 0.9.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/README.md +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ This Vite plugin instantly provisions a Postgres instance (via Neon) and injects
|
|
|
20
20
|
| **bun** | `bun add -D vite-plugin-neon-new` |
|
|
21
21
|
| **deno** | `deno add -D npm:vite-plugin-neon-new` |
|
|
22
22
|
|
|
23
|
+
> **Requirements:** Node.js >= 20.19.
|
|
24
|
+
|
|
23
25
|
## Usage
|
|
24
26
|
|
|
25
27
|
> **BREAKING CHANGE in v3.0.0**: The `referrer` option is now **required**.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;KAeK,qBAAA;;EAAA,UAAA,CAAA,EAAA,MAAA;EAgBI,SAAA,CAAA,EAAA,MAAc;EAAA,IAAA,CAAA,EAAA;IAAU,IAAA,EAAA,YAAA;IAAwB,IAAA,EAAA,MAAA;EAAM,CAAA;;;;;;iBAAtD,cAAA,UAAwB,wBAAwB"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import { resolve } from "node:path";
|
|
|
2
2
|
import { intro, log, outro } from "@clack/prompts";
|
|
3
3
|
import { instantPostgres } from "neon-new";
|
|
4
4
|
import { loadEnv } from "vite";
|
|
5
|
-
|
|
6
5
|
//#region src/index.ts
|
|
7
6
|
const DEFAULTS = {
|
|
8
7
|
dotEnvFile: ".env",
|
|
@@ -50,7 +49,7 @@ function postgresPlugin(options) {
|
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
//#endregion
|
|
55
53
|
export { postgresPlugin as default, postgresPlugin as postgres };
|
|
54
|
+
|
|
56
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { intro, log, outro } from \"@clack/prompts\";\nimport { instantPostgres } from \"neon-new\";\nimport { loadEnv, type Plugin } from \"vite\";\n\nconst DEFAULTS = {\n\tdotEnvFile: \".env\",\n\tdotEnvKey: \"DATABASE_URL\",\n\tseed: undefined,\n\tenvPrefix: \"VITE_\",\n\tsettings: {\n\t\tlogicalReplication: false,\n\t},\n};\n\ntype PostgresPluginOptions = {\n\treferrer: string;\n\tdotEnvFile?: string;\n\tdotEnvKey?: string;\n\tseed?: {\n\t\ttype: \"sql-script\";\n\t\tpath: string;\n\t};\n\tenvPrefix?: string;\n\tsettings?: {\n\t\tlogicalReplication?: boolean;\n\t};\n};\n\nlet claimProcessStarted = false;\n\nfunction postgresPlugin(options: PostgresPluginOptions): Plugin {\n\tif (!options?.referrer || options.referrer.trim() === \"\") {\n\t\tthrow new Error(\n\t\t\t\"vite-plugin-neon-new: 'referrer' option is required.\\n\\n\" +\n\t\t\t\t\"The referrer helps track usage for the Open Source Program.\\n\\n\" +\n\t\t\t\t\"Usage:\\n\" +\n\t\t\t\t\" postgres({ referrer: 'your-app-name' })\\n\\n\" +\n\t\t\t\t\"Examples:\\n\" +\n\t\t\t\t\" postgres({ referrer: 'github:username/repo-name' })\\n\" +\n\t\t\t\t\" postgres({ referrer: 'my-vite-app' })\\n\\n\" +\n\t\t\t\t\"For more information, visit: https://neon.com/docs/reference/instagres\",\n\t\t);\n\t}\n\n\tconst {\n\t\tdotEnvFile: envPath,\n\t\tdotEnvKey: envKey,\n\t\treferrer,\n\t\tseed,\n\t\tenvPrefix,\n\t\tsettings,\n\t} = {\n\t\t...DEFAULTS,\n\t\t...options,\n\t\tsettings: {\n\t\t\t...DEFAULTS.settings,\n\t\t\t...options.settings,\n\t\t},\n\t};\n\treturn {\n\t\tname: \"vite-plugin-neon-new\",\n\t\tenforce: \"pre\",\n\n\t\tasync config({ root, envDir }, { mode }) {\n\t\t\t// Don't run in production to prevent accidental creation of a Neon database on CI\n\t\t\tif (mode === \"production\" || claimProcessStarted) return;\n\n\t\t\tconst resolvedRoot = resolve(root ?? process.cwd());\n\t\t\tenvDir = envDir ? resolve(resolvedRoot, envDir) : resolvedRoot;\n\t\t\tconst resolvedEnvPath = resolve(\n\t\t\t\tenvDir,\n\t\t\t\tenvPath || DEFAULTS.dotEnvFile,\n\t\t\t);\n\n\t\t\tconst envVars = loadEnv(mode, envDir, envKey);\n\n\t\t\tif (Object.keys(envVars).length > 0) {\n\t\t\t\tconst envVar = envVars[envKey];\n\t\t\t\tif (!envVar) {\n\t\t\t\t\tlog.info(\n\t\t\t\t\t\t`Environment variable ${envKey} not found in ${resolvedEnvPath}. We will create one for you.`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tlog.info(\n\t\t\t\t\t\t`Environment variable ${envKey} found in ${resolvedEnvPath}. If you wish to create a new Neon database, please remove the existing variable.`,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tclaimProcessStarted = true;\n\n\t\t\tintro(\"Setting up your project with a Neon database.\");\n\t\t\tawait instantPostgres({\n\t\t\t\tdotEnvFile: envPath,\n\t\t\t\tdotEnvKey: envKey,\n\t\t\t\treferrer: `npm:vite-plugin-neon-new|${referrer}`,\n\t\t\t\tseed,\n\t\t\t\tenvPrefix,\n\t\t\t\tsettings,\n\t\t\t});\n\t\t\toutro(\"Neon database created successfully.\");\n\t\t},\n\t};\n}\n\nexport { postgresPlugin as postgres };\nexport default postgresPlugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { intro, log, outro } from \"@clack/prompts\";\nimport { instantPostgres } from \"neon-new\";\nimport { loadEnv, type Plugin } from \"vite\";\n\nconst DEFAULTS = {\n\tdotEnvFile: \".env\",\n\tdotEnvKey: \"DATABASE_URL\",\n\tseed: undefined,\n\tenvPrefix: \"VITE_\",\n\tsettings: {\n\t\tlogicalReplication: false,\n\t},\n};\n\ntype PostgresPluginOptions = {\n\treferrer: string;\n\tdotEnvFile?: string;\n\tdotEnvKey?: string;\n\tseed?: {\n\t\ttype: \"sql-script\";\n\t\tpath: string;\n\t};\n\tenvPrefix?: string;\n\tsettings?: {\n\t\tlogicalReplication?: boolean;\n\t};\n};\n\nlet claimProcessStarted = false;\n\nfunction postgresPlugin(options: PostgresPluginOptions): Plugin {\n\tif (!options?.referrer || options.referrer.trim() === \"\") {\n\t\tthrow new Error(\n\t\t\t\"vite-plugin-neon-new: 'referrer' option is required.\\n\\n\" +\n\t\t\t\t\"The referrer helps track usage for the Open Source Program.\\n\\n\" +\n\t\t\t\t\"Usage:\\n\" +\n\t\t\t\t\" postgres({ referrer: 'your-app-name' })\\n\\n\" +\n\t\t\t\t\"Examples:\\n\" +\n\t\t\t\t\" postgres({ referrer: 'github:username/repo-name' })\\n\" +\n\t\t\t\t\" postgres({ referrer: 'my-vite-app' })\\n\\n\" +\n\t\t\t\t\"For more information, visit: https://neon.com/docs/reference/instagres\",\n\t\t);\n\t}\n\n\tconst {\n\t\tdotEnvFile: envPath,\n\t\tdotEnvKey: envKey,\n\t\treferrer,\n\t\tseed,\n\t\tenvPrefix,\n\t\tsettings,\n\t} = {\n\t\t...DEFAULTS,\n\t\t...options,\n\t\tsettings: {\n\t\t\t...DEFAULTS.settings,\n\t\t\t...options.settings,\n\t\t},\n\t};\n\treturn {\n\t\tname: \"vite-plugin-neon-new\",\n\t\tenforce: \"pre\",\n\n\t\tasync config({ root, envDir }, { mode }) {\n\t\t\t// Don't run in production to prevent accidental creation of a Neon database on CI\n\t\t\tif (mode === \"production\" || claimProcessStarted) return;\n\n\t\t\tconst resolvedRoot = resolve(root ?? process.cwd());\n\t\t\tenvDir = envDir ? resolve(resolvedRoot, envDir) : resolvedRoot;\n\t\t\tconst resolvedEnvPath = resolve(\n\t\t\t\tenvDir,\n\t\t\t\tenvPath || DEFAULTS.dotEnvFile,\n\t\t\t);\n\n\t\t\tconst envVars = loadEnv(mode, envDir, envKey);\n\n\t\t\tif (Object.keys(envVars).length > 0) {\n\t\t\t\tconst envVar = envVars[envKey];\n\t\t\t\tif (!envVar) {\n\t\t\t\t\tlog.info(\n\t\t\t\t\t\t`Environment variable ${envKey} not found in ${resolvedEnvPath}. We will create one for you.`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tlog.info(\n\t\t\t\t\t\t`Environment variable ${envKey} found in ${resolvedEnvPath}. If you wish to create a new Neon database, please remove the existing variable.`,\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tclaimProcessStarted = true;\n\n\t\t\tintro(\"Setting up your project with a Neon database.\");\n\t\t\tawait instantPostgres({\n\t\t\t\tdotEnvFile: envPath,\n\t\t\t\tdotEnvKey: envKey,\n\t\t\t\treferrer: `npm:vite-plugin-neon-new|${referrer}`,\n\t\t\t\tseed,\n\t\t\t\tenvPrefix,\n\t\t\t\tsettings,\n\t\t\t});\n\t\t\toutro(\"Neon database created successfully.\");\n\t\t},\n\t};\n}\n\nexport { postgresPlugin as postgres };\nexport default postgresPlugin;\n"],"mappings":";;;;;AAKA,MAAM,WAAW;CAChB,YAAY;CACZ,WAAW;CACX,MAAM,KAAA;CACN,WAAW;CACX,UAAU,EACT,oBAAoB,MACrB;AACD;AAgBA,IAAI,sBAAsB;AAE1B,SAAS,eAAe,SAAwC;CAC/D,IAAI,CAAC,SAAS,YAAY,QAAQ,SAAS,KAAK,MAAM,IACrD,MAAM,IAAI,MACT,iWAQD;CAGD,MAAM,EACL,YAAY,SACZ,WAAW,QACX,UACA,MACA,WACA,aACG;EACH,GAAG;EACH,GAAG;EACH,UAAU;GACT,GAAG,SAAS;GACZ,GAAG,QAAQ;EACZ;CACD;CACA,OAAO;EACN,MAAM;EACN,SAAS;EAET,MAAM,OAAO,EAAE,MAAM,UAAU,EAAE,QAAQ;GAExC,IAAI,SAAS,gBAAgB,qBAAqB;GAElD,MAAM,eAAe,QAAQ,QAAQ,QAAQ,IAAI,CAAC;GAClD,SAAS,SAAS,QAAQ,cAAc,MAAM,IAAI;GAClD,MAAM,kBAAkB,QACvB,QACA,WAAW,SAAS,UACrB;GAEA,MAAM,UAAU,QAAQ,MAAM,QAAQ,MAAM;GAE5C,IAAI,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAEjC,IAAI,CADW,QAAQ,SAEtB,IAAI,KACH,wBAAwB,OAAO,gBAAgB,gBAAgB,8BAChE;QACM;IACN,IAAI,KACH,wBAAwB,OAAO,YAAY,gBAAgB,kFAC5D;IAEA;GACD;GAED,sBAAsB;GAEtB,MAAM,+CAA+C;GACrD,MAAM,gBAAgB;IACrB,YAAY;IACZ,WAAW;IACX,UAAU,4BAA4B;IACtC;IACA;IACA;GACD,CAAC;GACD,MAAM,qCAAqC;EAC5C;CACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-neon-new",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"neon",
|
|
6
6
|
"database",
|
|
@@ -28,12 +28,15 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vite": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.19.0"
|
|
33
|
+
},
|
|
31
34
|
"publishConfig": {
|
|
32
35
|
"access": "public"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@clack/prompts": "0.10.1",
|
|
36
|
-
"neon-new": "0.
|
|
39
|
+
"neon-new": "0.15.0"
|
|
37
40
|
},
|
|
38
41
|
"scripts": {
|
|
39
42
|
"build": "tsc --noEmit && tsdown",
|