houdini-svelte 0.17.6 → 0.17.7

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.
@@ -1,5 +1,5 @@
1
- houdini-svelte:compile: cache hit, replaying output 0a2f71d41e809878
1
+ houdini-svelte:compile: cache hit, replaying output c48e722ecc9917d1
2
2
  houdini-svelte:compile:
3
- houdini-svelte:compile: > houdini-svelte@0.17.6 compile /home/runner/work/houdini/houdini/packages/houdini-svelte
3
+ houdini-svelte:compile: > houdini-svelte@0.17.7 compile /home/runner/work/houdini/houdini/packages/houdini-svelte
4
4
  houdini-svelte:compile: > scripts build --plugin
5
5
  houdini-svelte:compile:
@@ -1,5 +1,5 @@
1
- houdini-svelte:typedefs: cache hit, replaying output a06350fabda49747
1
+ houdini-svelte:typedefs: cache hit, replaying output 228bbb4f90c4c367
2
2
  houdini-svelte:typedefs:
3
- houdini-svelte:typedefs: > houdini-svelte@0.17.6 typedefs /home/runner/work/houdini/houdini/packages/houdini-svelte
3
+ houdini-svelte:typedefs: > houdini-svelte@0.17.7 typedefs /home/runner/work/houdini/houdini/packages/houdini-svelte
4
4
  houdini-svelte:typedefs: > scripts typedefs --plugin
5
5
  houdini-svelte:typedefs:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # houdini-svelte
2
2
 
3
+ ## 0.17.7
4
+
5
+ ### 🐛 Fixes
6
+
7
+ - [#689](https://github.com/HoudiniGraphql/houdini/pull/689) [`db67e82`](https://github.com/HoudiniGraphql/houdini/commit/db67e822fcec2362538bda548d058fa7e3397ffa) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - Fix duplicate import for generated subscription stores
8
+
3
9
  ## 0.17.6
4
10
 
5
11
  ### 🐛 Fixes
@@ -179965,7 +179965,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config2.artifactImportP
179965
179965
  config2.paginationQueryName(doc.name)
179966
179966
  )}'` : ""}
179967
179967
 
179968
- // create the query store
179968
+ // create the fragment store
179969
179969
 
179970
179970
  export class ${storeName} extends ${store_class} {
179971
179971
  constructor() {
@@ -180132,7 +180132,6 @@ async function subscriptionStore({ config: config2, plugin_root }, doc) {
180132
180132
  const artifactName = `${doc.name}`;
180133
180133
  const { store_class, statement } = store_import2(config2, "subscription");
180134
180134
  const storeContent = `${statement}
180135
- import { SubscriptionStore } from '../runtime/stores'
180136
180135
 
180137
180136
  export class ${storeName} extends ${store_class} {
180138
180137
  constructor() {
@@ -179961,7 +179961,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config2.artifactImportP
179961
179961
  config2.paginationQueryName(doc.name)
179962
179962
  )}'` : ""}
179963
179963
 
179964
- // create the query store
179964
+ // create the fragment store
179965
179965
 
179966
179966
  export class ${storeName} extends ${store_class} {
179967
179967
  constructor() {
@@ -180128,7 +180128,6 @@ async function subscriptionStore({ config: config2, plugin_root }, doc) {
180128
180128
  const artifactName = `${doc.name}`;
180129
180129
  const { store_class, statement } = store_import2(config2, "subscription");
180130
180130
  const storeContent = `${statement}
180131
- import { SubscriptionStore } from '../runtime/stores'
180132
180131
 
180133
180132
  export class ${storeName} extends ${store_class} {
180134
180133
  constructor() {
@@ -294525,7 +294525,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config3.artifactImportP
294525
294525
  config3.paginationQueryName(doc.name)
294526
294526
  )}'` : ""}
294527
294527
 
294528
- // create the query store
294528
+ // create the fragment store
294529
294529
 
294530
294530
  export class ${storeName} extends ${store_class} {
294531
294531
  constructor() {
@@ -294692,7 +294692,6 @@ async function subscriptionStore({ config: config3, plugin_root }, doc) {
294692
294692
  const artifactName = `${doc.name}`;
294693
294693
  const { store_class, statement } = store_import2(config3, "subscription");
294694
294694
  const storeContent = `${statement}
294695
- import { SubscriptionStore } from '../runtime/stores'
294696
294695
 
294697
294696
  export class ${storeName} extends ${store_class} {
294698
294697
  constructor() {
@@ -294514,7 +294514,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config3.artifactImportP
294514
294514
  config3.paginationQueryName(doc.name)
294515
294515
  )}'` : ""}
294516
294516
 
294517
- // create the query store
294517
+ // create the fragment store
294518
294518
 
294519
294519
  export class ${storeName} extends ${store_class} {
294520
294520
  constructor() {
@@ -294681,7 +294681,6 @@ async function subscriptionStore({ config: config3, plugin_root }, doc) {
294681
294681
  const artifactName = `${doc.name}`;
294682
294682
  const { store_class, statement } = store_import2(config3, "subscription");
294683
294683
  const storeContent = `${statement}
294684
- import { SubscriptionStore } from '../runtime/stores'
294685
294684
 
294686
294685
  export class ${storeName} extends ${store_class} {
294687
294686
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "0.17.6",
3
+ "version": "0.17.7",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -9,7 +9,7 @@
9
9
  "ast-types": "^0.15.1",
10
10
  "estree-walker": "^3.0.1",
11
11
  "graphql": "^15.8.0",
12
- "houdini": "^0.17.6",
12
+ "houdini": "^0.17.7",
13
13
  "minimatch": "^5.1.0",
14
14
  "recast": "^0.21.5",
15
15
  "svelte": "^3.52.0"
@@ -0,0 +1,62 @@
1
+ import { fs, CollectedGraphQLDocument, path } from 'houdini'
2
+ import { mockCollectedDoc } from 'houdini/test'
3
+ import * as recast from 'recast'
4
+ import * as typeScriptParser from 'recast/parsers/typescript'
5
+ import { test, expect } from 'vitest'
6
+
7
+ import runPipeline from '..'
8
+ import '../..'
9
+ import { test_config } from '../../../test'
10
+ import { stores_directory } from '../../kit'
11
+
12
+ test('generates a store for every query', async function () {
13
+ const config = await test_config()
14
+ const plugin_root = config.pluginDirectory('test-plugin')
15
+
16
+ // the documents to test
17
+ const docs: CollectedGraphQLDocument[] = [
18
+ mockCollectedDoc(`fragment TestFragment1 on User { id }`),
19
+ mockCollectedDoc(`fragment TestFragment2 on User { id }`),
20
+ ]
21
+
22
+ // execute the generator
23
+ await runPipeline({ config, documents: docs, plugin_root, framework: 'kit' })
24
+
25
+ // look up the files in the artifact directory
26
+ const files = await fs.readdir(stores_directory(plugin_root))
27
+
28
+ // and they have the right names
29
+ expect(files).toEqual(expect.arrayContaining(['TestFragment1.js', 'TestFragment2.js']))
30
+ // and type definitions exist
31
+ expect(files).toEqual(expect.arrayContaining(['TestFragment1.d.ts', 'TestFragment2.d.ts']))
32
+
33
+ const contents = await fs.readFile(path.join(stores_directory(plugin_root), 'TestFragment1.js'))
34
+ const parsed = recast.parse(contents!, {
35
+ parser: typeScriptParser,
36
+ }).program
37
+
38
+ await expect(parsed).toMatchInlineSnapshot(
39
+ `
40
+ import { FragmentStore } from '$houdini/plugins/houdini-svelte/runtime/stores'
41
+ import artifact from '$houdini/artifacts/TestFragment1'
42
+
43
+
44
+ // create the fragment store
45
+
46
+ export class TestFragment1Store extends FragmentStore {
47
+ constructor() {
48
+ super({
49
+ artifact,
50
+ storeName: "TestFragment1Store",
51
+ variables: true,
52
+
53
+ })
54
+ }
55
+ }
56
+
57
+ export const GQL_TestFragment1 = new TestFragment1Store()
58
+
59
+ export default GQL_TestFragment1
60
+ `
61
+ )
62
+ })
@@ -38,7 +38,7 @@ ${
38
38
  : ''
39
39
  }
40
40
 
41
- // create the query store
41
+ // create the fragment store
42
42
 
43
43
  export class ${storeName} extends ${store_class} {
44
44
  constructor() {
@@ -0,0 +1,56 @@
1
+ import { fs, CollectedGraphQLDocument, path } from 'houdini'
2
+ import { mockCollectedDoc } from 'houdini/test'
3
+ import * as recast from 'recast'
4
+ import * as typeScriptParser from 'recast/parsers/typescript'
5
+ import { test, expect } from 'vitest'
6
+
7
+ import runPipeline from '..'
8
+ import '../..'
9
+ import { test_config } from '../../../test'
10
+ import { stores_directory } from '../../kit'
11
+
12
+ test('generates a store for every query', async function () {
13
+ const config = await test_config()
14
+ const plugin_root = config.pluginDirectory('test-plugin')
15
+
16
+ // the documents to test
17
+ const docs: CollectedGraphQLDocument[] = [
18
+ mockCollectedDoc(`mutation TestMutation1 { updateUser { id } }`),
19
+ mockCollectedDoc(`mutation TestMutation2 { updateUser { id } }`),
20
+ ]
21
+
22
+ // execute the generator
23
+ await runPipeline({ config, documents: docs, plugin_root, framework: 'kit' })
24
+
25
+ // look up the files in the artifact directory
26
+ const files = await fs.readdir(stores_directory(plugin_root))
27
+
28
+ // and they have the right names
29
+ expect(files).toEqual(expect.arrayContaining(['TestMutation1.js', 'TestMutation2.js']))
30
+ // and type definitions exist
31
+ expect(files).toEqual(expect.arrayContaining(['TestMutation1.d.ts', 'TestMutation2.d.ts']))
32
+
33
+ const contents = await fs.readFile(path.join(stores_directory(plugin_root), 'TestMutation1.js'))
34
+ const parsed = recast.parse(contents!, {
35
+ parser: typeScriptParser,
36
+ }).program
37
+
38
+ await expect(parsed).toMatchInlineSnapshot(
39
+ `
40
+ import artifact from '$houdini/artifacts/TestMutation1'
41
+ import { MutationStore } from '$houdini/plugins/houdini-svelte/runtime/stores'
42
+
43
+ export class TestMutation1Store extends MutationStore {
44
+ constructor() {
45
+ super({
46
+ artifact,
47
+ })
48
+ }
49
+ }
50
+
51
+ export const GQL_TestMutation1 = new TestMutation1Store()
52
+
53
+ export default GQL_TestMutation1
54
+ `
55
+ )
56
+ })
@@ -9,7 +9,7 @@ import '../..'
9
9
  import { pipeline_test, test_config } from '../../../test'
10
10
  import { stores_directory } from '../../kit'
11
11
 
12
- test('generates a store for every query', async function () {
12
+ test('generates a query store for every query', async function () {
13
13
  const config = await test_config()
14
14
  const plugin_root = config.pluginDirectory('test-plugin')
15
15
 
@@ -0,0 +1,59 @@
1
+ import { fs, CollectedGraphQLDocument, path } from 'houdini'
2
+ import { mockCollectedDoc } from 'houdini/test'
3
+ import * as recast from 'recast'
4
+ import * as typeScriptParser from 'recast/parsers/typescript'
5
+ import { test, expect } from 'vitest'
6
+
7
+ import runPipeline from '..'
8
+ import '../..'
9
+ import { test_config } from '../../../test'
10
+ import { stores_directory } from '../../kit'
11
+
12
+ test('generates a store for every query', async function () {
13
+ const config = await test_config()
14
+ const plugin_root = config.pluginDirectory('test-plugin')
15
+
16
+ // the documents to test
17
+ const docs: CollectedGraphQLDocument[] = [
18
+ mockCollectedDoc(`subscription TestSubscription1 { newUser { id } }`),
19
+ mockCollectedDoc(`subscription TestSubscription2 { newUser { id } }`),
20
+ ]
21
+
22
+ // execute the generator
23
+ await runPipeline({ config, documents: docs, plugin_root, framework: 'kit' })
24
+
25
+ // look up the files in the artifact directory
26
+ const files = await fs.readdir(stores_directory(plugin_root))
27
+
28
+ // and they have the right names
29
+ expect(files).toEqual(expect.arrayContaining(['TestSubscription1.js', 'TestSubscription2.js']))
30
+ // and type definitions exist
31
+ expect(files).toEqual(
32
+ expect.arrayContaining(['TestSubscription1.d.ts', 'TestSubscription2.d.ts'])
33
+ )
34
+
35
+ const contents = await fs.readFile(
36
+ path.join(stores_directory(plugin_root), 'TestSubscription1.js')
37
+ )
38
+ const parsed = recast.parse(contents!, {
39
+ parser: typeScriptParser,
40
+ }).program
41
+
42
+ await expect(parsed).toMatchInlineSnapshot(
43
+ `
44
+ import { SubscriptionStore } from '$houdini/plugins/houdini-svelte/runtime/stores'
45
+
46
+ export class TestSubscription1Store extends SubscriptionStore {
47
+ constructor() {
48
+ super({
49
+ artifact,
50
+ })
51
+ }
52
+ }
53
+
54
+ export const GQL_TestSubscription1 = new TestSubscription1Store()
55
+
56
+ export default GQL_TestSubscription1
57
+ `
58
+ )
59
+ })
@@ -17,7 +17,6 @@ export async function subscriptionStore(
17
17
 
18
18
  // the content of the store
19
19
  const storeContent = `${statement}
20
- import { SubscriptionStore } from '../runtime/stores'
21
20
 
22
21
  export class ${storeName} extends ${store_class} {
23
22
  constructor() {