postseed 0.1.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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +54 -0
  4. data/exe/postseed +6 -0
  5. data/lib/postseed/engine/node_modules/jiti/LICENSE +21 -0
  6. data/lib/postseed/engine/node_modules/jiti/README.md +258 -0
  7. data/lib/postseed/engine/node_modules/jiti/dist/babel.cjs +257 -0
  8. data/lib/postseed/engine/node_modules/jiti/dist/jiti.cjs +1 -0
  9. data/lib/postseed/engine/node_modules/jiti/lib/jiti-cli.mjs +34 -0
  10. data/lib/postseed/engine/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
  11. data/lib/postseed/engine/node_modules/jiti/lib/jiti-native.mjs +121 -0
  12. data/lib/postseed/engine/node_modules/jiti/lib/jiti-register.d.mts +1 -0
  13. data/lib/postseed/engine/node_modules/jiti/lib/jiti-register.mjs +4 -0
  14. data/lib/postseed/engine/node_modules/jiti/lib/jiti-static.mjs +23 -0
  15. data/lib/postseed/engine/node_modules/jiti/lib/jiti.cjs +30 -0
  16. data/lib/postseed/engine/node_modules/jiti/lib/jiti.d.cts +8 -0
  17. data/lib/postseed/engine/node_modules/jiti/lib/jiti.d.mts +8 -0
  18. data/lib/postseed/engine/node_modules/jiti/lib/jiti.mjs +29 -0
  19. data/lib/postseed/engine/node_modules/jiti/lib/types.d.ts +420 -0
  20. data/lib/postseed/engine/node_modules/jiti/package.json +146 -0
  21. data/lib/postseed/engine/package.json +1 -0
  22. data/lib/postseed/engine/postseed.mjs +503 -0
  23. data/lib/postseed/studio-dist/assets/TemplatesScreen-DbIyICkA.js +332 -0
  24. data/lib/postseed/studio-dist/assets/index-BM0OsIyI.js +55 -0
  25. data/lib/postseed/studio-dist/assets/index-Dqw83Nte.css +2 -0
  26. data/lib/postseed/studio-dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  27. data/lib/postseed/studio-dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  28. data/lib/postseed/studio-dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  29. data/lib/postseed/studio-dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  30. data/lib/postseed/studio-dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  31. data/lib/postseed/studio-dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  32. data/lib/postseed/studio-dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  33. data/lib/postseed/studio-dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  34. data/lib/postseed/studio-dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  35. data/lib/postseed/studio-dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  36. data/lib/postseed/studio-dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  37. data/lib/postseed/studio-dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  38. data/lib/postseed/studio-dist/favicon.svg +6 -0
  39. data/lib/postseed/studio-dist/index.html +16 -0
  40. data/lib/postseed/version.rb +5 -0
  41. data/lib/postseed.rb +103 -0
  42. metadata +89 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4effa694e20936cf5281dbdaabf20252ae45a0a4ef70cc4a5ce92f8d689f65dd
4
+ data.tar.gz: 372c680bdbb78db149c632c03359241a66a1bcd8a600025ce4732d8ade81d6d4
5
+ SHA512:
6
+ metadata.gz: ca0a86c77c9e9d9f628df37be6e5b0e3c45433a6f674c2e34ac99eb6e2ecf38a92626da6e1e087bc296eeae040ee06c18e85337408cd36083d6a0405226cbed6
7
+ data.tar.gz: 305cb08acf01a92eca1fa92bce3d62db1637550b00520b4afd9701a02512c0e158c152e4398e084fc3f42f86a5e54b1e3071a11819b97c65370eb62b84ccb4a0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sagar Pinninti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # postseed (Ruby)
2
+
3
+ [![Gem Version](https://img.shields.io/gem/v/postseed)](https://rubygems.org/gems/postseed)
4
+ [![CI](https://github.com/isagarpinninti/postseed/actions/workflows/ci.yml/badge.svg)](https://github.com/isagarpinninti/postseed/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-black.svg)](https://github.com/isagarpinninti/postseed/blob/main/LICENSE)
6
+
7
+ **Realistic Postgres seed data. In seconds.** Postseed generates seed data that respects your foreign keys, enums and uniqueness, never leaves your machine, and is deterministic: the same schema, seed and version give byte-identical output.
8
+
9
+ This gem bundles the [Postseed](https://github.com/isagarpinninti/postseed) engine and runs it with **Node.js 20 or newer** (it must be on your `PATH`, or set `POSTSEED_NODE`). Nothing else to install.
10
+
11
+ ```bash
12
+ gem install postseed
13
+ postseed # opens Studio, the local web app, on 127.0.0.1
14
+ ```
15
+
16
+ ## Command line
17
+
18
+ ```bash
19
+ postseed generate --schema schema.sql --rows 50 --seed 42 --out seed.sql
20
+ postseed insert --url "$DATABASE_URL" --dry-run # validate against your database, then roll back
21
+ postseed insert --url "$DATABASE_URL" --yes # really insert, in one transaction
22
+ ```
23
+
24
+ See the [documentation](https://github.com/isagarpinninti/postseed#readme) for every option.
25
+
26
+ ## From Ruby
27
+
28
+ ```ruby
29
+ require "postseed"
30
+
31
+ sql = Postseed.generate(<<~SQL, rows: 25, seed: 42)
32
+ CREATE TABLE users (id serial PRIMARY KEY, email text UNIQUE NOT NULL);
33
+ CREATE TABLE posts (id serial PRIMARY KEY, user_id int NOT NULL REFERENCES users(id), title text);
34
+ SQL
35
+ # `sql` is a transactional script: every post points at a real user, every email is unique.
36
+ ```
37
+
38
+ `Postseed.generate(schema_sql, rows: 50, seed: 42, format: "sql", tables: nil, table_rows: nil, null_ratio: nil, now: nil)`
39
+ returns the text (`format` is `"sql"` or `"json"`) and raises `Postseed::Error` with the engine's message if it
40
+ cannot. The same arguments always return the same text.
41
+
42
+ `Postseed.run(args, input: nil)` runs any CLI command and returns `[stdout, stderr, status]`.
43
+
44
+ In a Rails project, generate fixtures from `db/structure.sql`:
45
+
46
+ ```bash
47
+ postseed generate --schema db/structure.sql --rows 25 --seed 7 --out db/seeds.sql
48
+ ```
49
+
50
+ ## Notes
51
+
52
+ - Ruby 2.6 or newer. The gem is pure Ruby plus a bundled JavaScript engine, so there is one gem for every platform.
53
+ - It is the same engine as the `postseed` npm package and the `postseed` Python package, so output is identical across all three.
54
+ - MIT licensed.
data/exe/postseed ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "postseed"
5
+
6
+ exit Postseed.exec(ARGV)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Pooya Parsa <pooya@pi0.io>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,258 @@
1
+ # jiti
2
+
3
+ <!-- automd:badges color=F0DB4F bundlephobia -->
4
+
5
+ [![npm version](https://img.shields.io/npm/v/jiti?color=F0DB4F)](https://npmjs.com/package/jiti)
6
+ [![npm downloads](https://img.shields.io/npm/dm/jiti?color=F0DB4F)](https://npmjs.com/package/jiti)
7
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/jiti?color=F0DB4F)](https://bundlephobia.com/package/jiti)
8
+
9
+ <!-- /automd -->
10
+
11
+ > This is the active development branch. Check out [jiti/v1](https://github.com/unjs/jiti/tree/v1) for legacy v1 docs and code.
12
+
13
+ ## 🌟 Used in
14
+
15
+ [Docusaurus](https://docusaurus.io/), [ESLint](https://github.com/eslint/eslint), [FormKit](https://formkit.com/), [Histoire](https://histoire.dev/), [Knip](https://knip.dev/), [Nitro](https://nitro.unjs.io/), [Nuxt](https://nuxt.com/), [PostCSS loader](https://github.com/webpack-contrib/postcss-loader), [Rsbuild](https://rsbuild.dev/), [Size Limit](https://github.com/ai/size-limit), [Slidev](https://sli.dev/), [Tailwindcss](https://tailwindcss.com/), [Tokenami](https://github.com/tokenami/tokenami), [UnoCSS](https://unocss.dev/), [WXT](https://wxt.dev/), [Winglang](https://www.winglang.io/), [Graphql code generator](https://the-guild.dev/graphql/codegen), [Lingui](https://lingui.dev/), [Scaffdog](https://scaff.dog/), [Storybook](https://storybook.js.org), [...UnJS ecosystem](https://unjs.io/), [...60M+ npm monthly downloads](https://npm.chart.dev/jiti), [...6M+ public repositories](https://github.com/unjs/jiti/network/dependents).
16
+
17
+ ## ✅ Features
18
+
19
+ - Seamless TypeScript and ESM syntax support for Node.js
20
+ - Seamless interoperability between ESM and CommonJS
21
+ - Asynchronous API to replace `import()`
22
+ - Synchronous API to replace `require()` (deprecated)
23
+ - Super slim and zero dependency
24
+ - Custom resolve aliases
25
+ - Smart syntax detection to avoid extra transforms
26
+ - Node.js native `require.cache` integration
27
+ - Filesystem transpile with hard disk caches
28
+ - ESM Loader support
29
+ - JSX support (opt-in)
30
+
31
+ > [!IMPORTANT]
32
+ > To enhance compatibility, jiti `>=2.1` enabled [`interopDefault`](#interopdefault) using a new Proxy method. If you migrated to `2.0.0` earlier, this might have caused behavior changes. In case of any issues during the upgrade, please [report](https://github.com/unjs/jiti/issues) so we can investigate to solve them. 🙏🏼
33
+
34
+ ## 💡 Usage
35
+
36
+ ### CLI
37
+
38
+ You can use `jiti` CLI to quickly run any script with TypeScript and native ESM support!
39
+
40
+ ```bash
41
+ npx jiti ./index.ts
42
+ ```
43
+
44
+ ### Programmatic
45
+
46
+ Initialize a jiti instance:
47
+
48
+ ```js
49
+ // ESM
50
+ import { createJiti } from "jiti";
51
+ const jiti = createJiti(import.meta.url);
52
+
53
+ // CommonJS (deprecated)
54
+ const { createJiti } = require("jiti");
55
+ const jiti = createJiti(__filename);
56
+ ```
57
+
58
+ Import (async) and resolve with ESM compatibility:
59
+
60
+ ```js
61
+ // jiti.import(id) is similar to import(id)
62
+ const mod = await jiti.import("./path/to/file.ts");
63
+
64
+ // jiti.esmResolve(id) is similar to import.meta.resolve(id)
65
+ const resolvedPath = jiti.esmResolve("./src");
66
+ ```
67
+
68
+ If you need the default export of module, you can use `jiti.import(id, { default: true })` as shortcut to `mod?.default ?? mod`.
69
+
70
+ ```js
71
+ // shortcut to mod?.default ?? mod
72
+ const modDefault = await jiti.import("./path/to/file.ts", { default: true });
73
+ ```
74
+
75
+ CommonJS (sync & deprecated):
76
+
77
+ ```js
78
+ // jiti() is similar to require(id)
79
+ const mod = jiti("./path/to/file.ts");
80
+
81
+ // jiti.resolve() is similar to require.resolve(id)
82
+ const resolvedPath = jiti.resolve("./src");
83
+ ```
84
+
85
+ You can also pass options as the second argument:
86
+
87
+ ```js
88
+ const jiti = createJiti(import.meta.url, { debug: true });
89
+ ```
90
+
91
+ ### Register global ESM loader
92
+
93
+ You can globally register jiti using [global hooks](https://nodejs.org/api/module.html#initialize). (Important: Requires Node.js > 20)
94
+
95
+ ```js
96
+ import "jiti/register";
97
+ ```
98
+
99
+ Or:
100
+
101
+ ```bash
102
+ node --import jiti/register index.ts
103
+ ```
104
+
105
+ ## 🎈 `jiti/native`
106
+
107
+ You can alias `jiti` to `jiti/native` to directly depend on runtime's [`import.meta.resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve) and dynamic [`import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) support. This allows easing up the ecosystem transition to runtime native support by giving the same API of jiti.
108
+
109
+ ## ⚙️ Options
110
+
111
+ ### `debug`
112
+
113
+ - Type: Boolean
114
+ - Default: `false`
115
+ - Environment variable: `JITI_DEBUG`
116
+
117
+ Enable verbose logging. You can use `JITI_DEBUG=1 <your command>` to enable it.
118
+
119
+ ### `fsCache`
120
+
121
+ - Type: Boolean | String
122
+ - Default: `true`
123
+ - Environment variable: `JITI_FS_CACHE`
124
+
125
+ Filesystem source cache (enabled by default)
126
+
127
+ By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
128
+
129
+ **Note:** It is recommended that this option be enabled for better performance.
130
+
131
+ ### `rebuildFsCache`
132
+
133
+ - Type: Boolean
134
+ - Default: `false`
135
+ - Environment variable: `JITI_REBUILD_FS_CACHE`
136
+
137
+ Rebuild filesystem source cache created by `fsCache`.
138
+
139
+ ### `moduleCache`
140
+
141
+ - Type: String
142
+ - Default: `true`
143
+ - Environment variable: `JITI_MODULE_CACHE`
144
+
145
+ Runtime module cache (enabled by default).
146
+
147
+ Disabling allows editing code and importing the same module multiple times.
148
+
149
+ When enabled, jiti integrates with Node.js native CommonJS cache-store.
150
+
151
+ ### `transform`
152
+
153
+ - Type: Function
154
+ - Default: Babel (lazy loaded)
155
+
156
+ Transform function. See [src/babel](./src/babel.ts) for more details
157
+
158
+ ### `sourceMaps`
159
+
160
+ - Type: Boolean
161
+ - Default `false`
162
+ - Environment variable: `JITI_SOURCE_MAPS`
163
+
164
+ Add inline source map to transformed source for better debugging.
165
+
166
+ ### `interopDefault`
167
+
168
+ - Type: Boolean
169
+ - Default: `true`
170
+ - Environment variable: `JITI_INTEROP_DEFAULT`
171
+
172
+ Jiti combines module exports with the `default` export using an internal Proxy to improve compatibility with mixed CJS/ESM usage. You can check the current implementation [here](https://github.com/unjs/jiti/blob/main/src/utils.ts#L105).
173
+
174
+ > [!WARNING]
175
+ > This option wraps **all imported modules** in a Proxy, which adds ~25-50ns overhead per property access. For performance-critical hot paths where you access module exports very frequently, consider setting `interopDefault: false` or `JITI_INTEROP_DEFAULT=false`.
176
+
177
+ ### `alias`
178
+
179
+ - Type: Object
180
+ - Default: -
181
+ - Environment variable: `JITI_ALIAS`
182
+
183
+ You can also pass an object to the environment variable for inline config. Example: `JITI_ALIAS='{"~/*": "./src/*"}' jiti ...`.
184
+
185
+ Custom alias map used to resolve IDs.
186
+
187
+ ### `tsconfigPaths`
188
+
189
+ - Type: Boolean | String
190
+ - Default: `false`
191
+ - Environment variable: `JITI_TSCONFIG_PATHS`
192
+
193
+ Enable TypeScript [`paths`](https://www.typescriptlang.org/tsconfig/#paths) resolution using [`get-tsconfig`](https://github.com/privatenumber/get-tsconfig).
194
+
195
+ - `true`: Auto-discover `tsconfig.json` by walking up from the jiti instance's parent path.
196
+ - `string`: Explicit path to a `tsconfig.json` file.
197
+ - `false` (default): Disabled.
198
+
199
+ ### `nativeModules`
200
+
201
+ - Type: Array
202
+ - Default: ['typescript']
203
+ - Environment variable: `JITI_NATIVE_MODULES`
204
+
205
+ List of modules (within `node_modules`) to always use native `require()` for them.
206
+
207
+ ### `transformModules`
208
+
209
+ - Type: Array
210
+ - Default: []
211
+ - Environment variable: `JITI_TRANSFORM_MODULES`
212
+
213
+ List of modules (within `node_modules`) to transform them regardless of syntax.
214
+
215
+ ### `importMeta`
216
+
217
+ Parent module's [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) context to use for ESM resolution. (only used for `jiti/native` import).
218
+
219
+ ### `tryNative`
220
+
221
+ - Type: Boolean
222
+ - Default: Enabled if bun is detected
223
+ - Environment variable: `JITI_TRY_NATIVE`
224
+
225
+ Try to use native require and import without jiti transformations first.
226
+
227
+ ### `jsx`
228
+
229
+ - Type: Boolean | {options}
230
+ - Default: `false`
231
+ - Environment Variable: `JITI_JSX`
232
+
233
+ Enable JSX support using [`@babel/plugin-transform-react-jsx`](https://babeljs.io/docs/babel-plugin-transform-react-jsx).
234
+
235
+ See [`test/fixtures/jsx`](./test/fixtures/jsx) for framework integration examples.
236
+
237
+ ## Development
238
+
239
+ - Clone this repository
240
+ - Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
241
+ - Install dependencies using `pnpm install`
242
+ - Run `pnpm dev`
243
+ - Run `pnpm jiti ./test/path/to/file.ts`
244
+
245
+ ## License
246
+
247
+ <!-- automd:contributors license=MIT author="pi0" -->
248
+
249
+ Published under the [MIT](https://github.com/unjs/jiti/blob/main/LICENSE) license.
250
+ Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/jiti/graphs/contributors) 💛
251
+ <br><br>
252
+ <a href="https://github.com/unjs/jiti/graphs/contributors">
253
+ <img src="https://contrib.rocks/image?repo=unjs/jiti" />
254
+ </a>
255
+
256
+ <!-- /automd -->
257
+
258
+ <!-- automd:with-automd -->