@mearie/vite 0.0.0 → 0.0.1-next.3

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 CHANGED
@@ -1,146 +1,43 @@
1
1
  # @mearie/vite
2
2
 
3
- Vite plugin for Mearie GraphQL code generation.
3
+ Vite plugin for Mearie GraphQL client.
4
4
 
5
- ## Features
6
-
7
- - ✅ **Zero Configuration** - No additional plugins required
8
- - 🔍 Automatically extracts GraphQL operations from your source code
9
- - 📦 Supports multiple file types: `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`, `.svelte`, `.astro`, `.graphql`, `.gql`
10
- - 🔥 Hot Module Replacement (HMR) support for schema changes
11
- - ⚡ Fast - Uses native Node.js WASM support (no bundler plugins needed)
5
+ This package provides a Vite plugin that enables automatic type generation from
6
+ GraphQL queries written as template literals in your code.
12
7
 
13
8
  ## Installation
14
9
 
15
10
  ```bash
16
- pnpm add -D @mearie/vite
11
+ npm install @mearie/vite
17
12
  ```
18
13
 
19
14
  ## Usage
20
15
 
21
- ### Basic Setup
16
+ Add the plugin to your Vite configuration:
22
17
 
23
18
  ```typescript
24
19
  // vite.config.ts
25
20
  import { defineConfig } from 'vite';
26
- import { mearie } from '@mearie/vite';
21
+ import mearie from '@mearie/vite';
27
22
 
28
23
  export default defineConfig({
29
- plugins: [
30
- mearie({
31
- schema: 'schema.graphql',
32
- output: 'src/generated/mearie.ts',
33
- watch: true,
34
- }),
35
- ],
24
+ plugins: [mearie()],
36
25
  });
37
26
  ```
38
27
 
39
- ### GraphQL in Your Code
40
-
41
- The plugin supports multiple ways to define GraphQL operations:
42
-
43
- #### 1. Using `gql` tagged template
28
+ By default, the plugin looks for `schema.graphql` in your project root. You can
29
+ customize the schema location and other options:
44
30
 
45
31
  ```typescript
46
- import { gql } from 'mearie';
47
-
48
- const query = gql\`
49
- query GetUser($id: ID!) {
50
- user(id: $id) {
51
- id
52
- name
53
- }
54
- }
55
- \`;
56
- ```
57
-
58
- #### 2. Using `/* GraphQL */` comment
59
-
60
- ```typescript
61
- const query = /* GraphQL */ \`
62
- query GetUser($id: ID!) {
63
- user(id: $id) {
64
- id
65
- name
66
- }
67
- }
68
- \`;
69
- ```
70
-
71
- #### 3. In `.graphql` or `.gql` files
72
-
73
- ```graphql
74
- query GetUser($id: ID!) {
75
- user(id: $id) {
76
- id
77
- name
78
- }
79
- }
80
- ```
81
-
82
- ## Options
83
-
84
- ### `schema`
85
-
86
- - Type: `string`
87
- - Optional
88
-
89
- Path to your GraphQL schema file.
90
-
91
- ### `output`
92
-
93
- - Type: `string`
94
- - Default: `'src/generated/mearie.ts'`
95
-
96
- Output path for generated TypeScript files.
97
-
98
- ### `watch`
99
-
100
- - Type: `boolean`
101
- - Default: `true`
102
-
103
- Whether to watch for schema changes and trigger HMR.
104
-
105
- ## Testing
106
-
107
- ### Run Unit Tests
108
-
109
- ```bash
110
- pnpm test
111
- ```
112
-
113
- ### Run Example Project
114
-
115
- ```bash
116
- cd examples/basic
117
- pnpm install
118
- pnpm dev
119
- ```
120
-
121
- ### Manual Testing
122
-
123
- 1. Create a Vite project
124
- 2. Add `@mearie/vite` as a dev dependency
125
- 3. Configure the plugin in `vite.config.ts`
126
- 4. Add GraphQL operations to your source code
127
- 5. Run `pnpm dev` or `pnpm build`
128
- 6. Check the generated TypeScript file at the specified output path
129
-
130
- ## Development
131
-
132
- ### Build
133
-
134
- ```bash
135
- pnpm build
136
- ```
137
-
138
- ### Watch Mode
139
-
140
- ```bash
141
- pnpm test:watch
32
+ export default defineConfig({
33
+ plugins: [
34
+ mearie({
35
+ schema: './path/to/schema.graphql',
36
+ }),
37
+ ],
38
+ });
142
39
  ```
143
40
 
144
- ## License
41
+ ## Documentation
145
42
 
146
- MIT
43
+ Full documentation is available at <https://mearie.dev/config/codegen>.
package/dist/index.cjs CHANGED
@@ -47,14 +47,14 @@ const mearie = (options = {}) => {
47
47
  cwd: viteConfig.root,
48
48
  filename: options.config
49
49
  }), options);
50
- const { schemas, documents, exclude } = mearieConfig;
50
+ const { schema, document, exclude } = mearieConfig;
51
51
  context = new __mearie_codegen.CodegenContext();
52
52
  const schemaFiles = await (0, __mearie_codegen.findFiles)(viteConfig.root, {
53
- include: schemas,
53
+ include: schema,
54
54
  exclude
55
55
  });
56
56
  const documentFiles = await (0, __mearie_codegen.findFiles)(viteConfig.root, {
57
- include: documents,
57
+ include: document,
58
58
  exclude
59
59
  });
60
60
  await Promise.all([...schemaFiles.map((file) => context.addSchema(file)), ...documentFiles.map((file) => context.addDocument(file))]);
@@ -86,14 +86,14 @@ const mearie = (options = {}) => {
86
86
  },
87
87
  async hotUpdate({ file, type }) {
88
88
  if (!context || !mearieConfig) return;
89
- const { schemas, documents, exclude } = mearieConfig;
89
+ const { schema, document, exclude } = mearieConfig;
90
90
  const relativePath = node_path.default.relative(viteConfig.root, file);
91
91
  const schemaMatcher = (0, __mearie_codegen.createMatcher)({
92
- include: schemas,
92
+ include: schema,
93
93
  exclude
94
94
  });
95
95
  const documentMatcher = (0, __mearie_codegen.createMatcher)({
96
- include: documents,
96
+ include: document,
97
97
  exclude
98
98
  });
99
99
  const matchesSchema = schemaMatcher(relativePath);
package/dist/index.js CHANGED
@@ -20,14 +20,14 @@ const mearie = (options = {}) => {
20
20
  cwd: viteConfig.root,
21
21
  filename: options.config
22
22
  }), options);
23
- const { schemas, documents, exclude } = mearieConfig;
23
+ const { schema, document, exclude } = mearieConfig;
24
24
  context = new CodegenContext();
25
25
  const schemaFiles = await findFiles(viteConfig.root, {
26
- include: schemas,
26
+ include: schema,
27
27
  exclude
28
28
  });
29
29
  const documentFiles = await findFiles(viteConfig.root, {
30
- include: documents,
30
+ include: document,
31
31
  exclude
32
32
  });
33
33
  await Promise.all([...schemaFiles.map((file) => context.addSchema(file)), ...documentFiles.map((file) => context.addDocument(file))]);
@@ -59,14 +59,14 @@ const mearie = (options = {}) => {
59
59
  },
60
60
  async hotUpdate({ file, type }) {
61
61
  if (!context || !mearieConfig) return;
62
- const { schemas, documents, exclude } = mearieConfig;
62
+ const { schema, document, exclude } = mearieConfig;
63
63
  const relativePath = path.relative(viteConfig.root, file);
64
64
  const schemaMatcher = createMatcher({
65
- include: schemas,
65
+ include: schema,
66
66
  exclude
67
67
  });
68
68
  const documentMatcher = createMatcher({
69
- include: documents,
69
+ include: document,
70
70
  exclude
71
71
  });
72
72
  const matchesSchema = schemaMatcher(relativePath);
package/package.json CHANGED
@@ -1,24 +1,53 @@
1
1
  {
2
2
  "name": "@mearie/vite",
3
- "version": "0.0.0",
4
- "description": "Vite plugin for Mearie",
3
+ "version": "0.0.1-next.3",
4
+ "description": "Type-safe, zero-overhead GraphQL client",
5
+ "keywords": [
6
+ "graphql",
7
+ "graphql-client",
8
+ "typescript",
9
+ "codegen",
10
+ "cache"
11
+ ],
12
+ "homepage": "https://github.com/devunt/mearie#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/devunt/mearie/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/devunt/mearie.git",
19
+ "directory": "packages/vite"
20
+ },
21
+ "funding": {
22
+ "type": "github",
23
+ "url": "https://github.com/sponsors/devunt"
24
+ },
5
25
  "license": "MIT",
26
+ "author": "Bae Junehyeon <finn@penxle.io>",
27
+ "sideEffects": false,
6
28
  "type": "module",
7
- "main": "./src/index.ts",
29
+ "main": "./dist/index.cjs",
8
30
  "files": [
9
- "dist"
31
+ "dist",
32
+ "package.json",
33
+ "README.md"
10
34
  ],
11
35
  "dependencies": {
12
- "@mearie/codegen": "0.0.0",
13
- "@mearie/config": "0.0.0",
14
- "@mearie/core": "0.0.0"
36
+ "@mearie/codegen": "0.0.1-next.3",
37
+ "@mearie/config": "0.0.1-next.3",
38
+ "@mearie/core": "0.0.1-next.3"
15
39
  },
16
40
  "devDependencies": {
17
- "tsdown": "^0.15.7",
41
+ "tsdown": "^0.15.8",
18
42
  "tsx": "^4.20.6",
19
43
  "vite": "^7.1.10",
20
44
  "vitest": "^3.2.4"
21
45
  },
46
+ "engines": {
47
+ "bun": ">=1.2.0",
48
+ "deno": ">=2.2.0",
49
+ "node": ">=20.0.0"
50
+ },
22
51
  "publishConfig": {
23
52
  "access": "public"
24
53
  },
@@ -34,6 +63,9 @@
34
63
  "types": "./dist/index.d.ts",
35
64
  "import": "./dist/index.js",
36
65
  "require": "./dist/index.cjs"
37
- }
38
- }
66
+ },
67
+ "./package.json": "./package.json"
68
+ },
69
+ "module": "./dist/index.js",
70
+ "types": "./dist/index.d.ts"
39
71
  }
package/src/index.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * Vite plugin for Mearie GraphQL code generation.
3
- *
4
- * This plugin extracts GraphQL operations from your source files and
5
- * generates TypeScript types and runtime code using `@mearie/native`.
6
- */
7
-
8
- export { mearie } from './plugin.ts';
9
- export type { MearieOptions } from './types.ts';