houdini-svelte 0.17.6 → 0.17.8
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/.turbo/turbo-compile.log +2 -2
- package/.turbo/turbo-typedefs.log +2 -2
- package/CHANGELOG.md +15 -0
- package/build/plugin-cjs/index.js +3 -3
- package/build/plugin-esm/index.js +3 -3
- package/build/test-cjs/index.js +3 -3
- package/build/test-esm/index.js +3 -3
- package/package.json +2 -2
- package/src/plugin/codegen/stores/fragment.test.ts +62 -0
- package/src/plugin/codegen/stores/fragment.ts +1 -1
- package/src/plugin/codegen/stores/mutation.test.ts +56 -0
- package/src/plugin/codegen/stores/query.test.ts +1 -1
- package/src/plugin/codegen/stores/subscription.test.ts +60 -0
- package/src/plugin/codegen/stores/subscription.ts +2 -2
package/.turbo/turbo-compile.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
houdini-svelte:compile: cache hit, replaying output
|
|
1
|
+
houdini-svelte:compile: cache hit, replaying output 4100612deed6d47b
|
|
2
2
|
houdini-svelte:compile:
|
|
3
|
-
houdini-svelte:compile: > houdini-svelte@0.17.
|
|
3
|
+
houdini-svelte:compile: > houdini-svelte@0.17.8 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
|
|
1
|
+
houdini-svelte:typedefs: cache hit, replaying output 83f9faf828e6112f
|
|
2
2
|
houdini-svelte:typedefs:
|
|
3
|
-
houdini-svelte:typedefs: > houdini-svelte@0.17.
|
|
3
|
+
houdini-svelte:typedefs: > houdini-svelte@0.17.8 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,20 @@
|
|
|
1
1
|
# houdini-svelte
|
|
2
2
|
|
|
3
|
+
## 0.17.8
|
|
4
|
+
|
|
5
|
+
### 🐛 Fixes
|
|
6
|
+
|
|
7
|
+
- [#691](https://github.com/HoudiniGraphql/houdini/pull/691) [`e707fbe`](https://github.com/HoudiniGraphql/houdini/commit/e707fbec36c223ad549c31df6bfa68ae312ffa9a) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - Added artifact import to subscription stores
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- houdini@0.17.8
|
|
11
|
+
|
|
12
|
+
## 0.17.7
|
|
13
|
+
|
|
14
|
+
### 🐛 Fixes
|
|
15
|
+
|
|
16
|
+
- [#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
|
|
17
|
+
|
|
3
18
|
## 0.17.6
|
|
4
19
|
|
|
5
20
|
### 🐛 Fixes
|
|
@@ -179965,7 +179965,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config2.artifactImportP
|
|
|
179965
179965
|
config2.paginationQueryName(doc.name)
|
|
179966
179966
|
)}'` : ""}
|
|
179967
179967
|
|
|
179968
|
-
// create the
|
|
179968
|
+
// create the fragment store
|
|
179969
179969
|
|
|
179970
179970
|
export class ${storeName} extends ${store_class} {
|
|
179971
179971
|
constructor() {
|
|
@@ -180131,8 +180131,8 @@ async function subscriptionStore({ config: config2, plugin_root }, doc) {
|
|
|
180131
180131
|
const globalStoreName = global_store_name({ config: config2, name: doc.name });
|
|
180132
180132
|
const artifactName = `${doc.name}`;
|
|
180133
180133
|
const { store_class, statement } = store_import2(config2, "subscription");
|
|
180134
|
-
const storeContent =
|
|
180135
|
-
|
|
180134
|
+
const storeContent = `import artifact from '$houdini/artifacts/${artifactName}'
|
|
180135
|
+
${statement}
|
|
180136
180136
|
|
|
180137
180137
|
export class ${storeName} extends ${store_class} {
|
|
180138
180138
|
constructor() {
|
|
@@ -179961,7 +179961,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config2.artifactImportP
|
|
|
179961
179961
|
config2.paginationQueryName(doc.name)
|
|
179962
179962
|
)}'` : ""}
|
|
179963
179963
|
|
|
179964
|
-
// create the
|
|
179964
|
+
// create the fragment store
|
|
179965
179965
|
|
|
179966
179966
|
export class ${storeName} extends ${store_class} {
|
|
179967
179967
|
constructor() {
|
|
@@ -180127,8 +180127,8 @@ async function subscriptionStore({ config: config2, plugin_root }, doc) {
|
|
|
180127
180127
|
const globalStoreName = global_store_name({ config: config2, name: doc.name });
|
|
180128
180128
|
const artifactName = `${doc.name}`;
|
|
180129
180129
|
const { store_class, statement } = store_import2(config2, "subscription");
|
|
180130
|
-
const storeContent =
|
|
180131
|
-
|
|
180130
|
+
const storeContent = `import artifact from '$houdini/artifacts/${artifactName}'
|
|
180131
|
+
${statement}
|
|
180132
180132
|
|
|
180133
180133
|
export class ${storeName} extends ${store_class} {
|
|
180134
180134
|
constructor() {
|
package/build/test-cjs/index.js
CHANGED
|
@@ -294525,7 +294525,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config3.artifactImportP
|
|
|
294525
294525
|
config3.paginationQueryName(doc.name)
|
|
294526
294526
|
)}'` : ""}
|
|
294527
294527
|
|
|
294528
|
-
// create the
|
|
294528
|
+
// create the fragment store
|
|
294529
294529
|
|
|
294530
294530
|
export class ${storeName} extends ${store_class} {
|
|
294531
294531
|
constructor() {
|
|
@@ -294691,8 +294691,8 @@ async function subscriptionStore({ config: config3, plugin_root }, doc) {
|
|
|
294691
294691
|
const globalStoreName = global_store_name({ config: config3, name: doc.name });
|
|
294692
294692
|
const artifactName = `${doc.name}`;
|
|
294693
294693
|
const { store_class, statement } = store_import2(config3, "subscription");
|
|
294694
|
-
const storeContent =
|
|
294695
|
-
|
|
294694
|
+
const storeContent = `import artifact from '$houdini/artifacts/${artifactName}'
|
|
294695
|
+
${statement}
|
|
294696
294696
|
|
|
294697
294697
|
export class ${storeName} extends ${store_class} {
|
|
294698
294698
|
constructor() {
|
package/build/test-esm/index.js
CHANGED
|
@@ -294514,7 +294514,7 @@ ${paginationMethod ? `import _PaginationArtifact from '${config3.artifactImportP
|
|
|
294514
294514
|
config3.paginationQueryName(doc.name)
|
|
294515
294515
|
)}'` : ""}
|
|
294516
294516
|
|
|
294517
|
-
// create the
|
|
294517
|
+
// create the fragment store
|
|
294518
294518
|
|
|
294519
294519
|
export class ${storeName} extends ${store_class} {
|
|
294520
294520
|
constructor() {
|
|
@@ -294680,8 +294680,8 @@ async function subscriptionStore({ config: config3, plugin_root }, doc) {
|
|
|
294680
294680
|
const globalStoreName = global_store_name({ config: config3, name: doc.name });
|
|
294681
294681
|
const artifactName = `${doc.name}`;
|
|
294682
294682
|
const { store_class, statement } = store_import2(config3, "subscription");
|
|
294683
|
-
const storeContent =
|
|
294684
|
-
|
|
294683
|
+
const storeContent = `import artifact from '$houdini/artifacts/${artifactName}'
|
|
294684
|
+
${statement}
|
|
294685
294685
|
|
|
294686
294686
|
export class ${storeName} extends ${store_class} {
|
|
294687
294687
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.8",
|
|
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.
|
|
12
|
+
"houdini": "^0.17.8",
|
|
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 fragment', 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
|
+
})
|
|
@@ -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 mutation', 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,60 @@
|
|
|
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 subscription', 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 artifact from '$houdini/artifacts/TestSubscription1'
|
|
45
|
+
import { SubscriptionStore } from '$houdini/plugins/houdini-svelte/runtime/stores'
|
|
46
|
+
|
|
47
|
+
export class TestSubscription1Store extends SubscriptionStore {
|
|
48
|
+
constructor() {
|
|
49
|
+
super({
|
|
50
|
+
artifact,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const GQL_TestSubscription1 = new TestSubscription1Store()
|
|
56
|
+
|
|
57
|
+
export default GQL_TestSubscription1
|
|
58
|
+
`
|
|
59
|
+
)
|
|
60
|
+
})
|
|
@@ -16,8 +16,8 @@ export async function subscriptionStore(
|
|
|
16
16
|
const { store_class, statement } = store_import(config, 'subscription')
|
|
17
17
|
|
|
18
18
|
// the content of the store
|
|
19
|
-
const storeContent =
|
|
20
|
-
|
|
19
|
+
const storeContent = `import artifact from '$houdini/artifacts/${artifactName}'
|
|
20
|
+
${statement}
|
|
21
21
|
|
|
22
22
|
export class ${storeName} extends ${store_class} {
|
|
23
23
|
constructor() {
|