houdini 0.15.9 โ 0.16.0-next.2
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/.eslintrc.cjs +36 -0
- package/.husky/pre-commit +0 -0
- package/.prettierignore +0 -1
- package/.prettierrc +4 -1
- package/CHANGELOG.md +40 -0
- package/README.md +8 -7
- package/build/cmd/generate.js +190 -96
- package/build/cmd/generators/artifacts/fieldKey.js +1 -4
- package/build/cmd/generators/artifacts/index.d.ts +1 -1
- package/build/cmd/generators/artifacts/index.js +17 -23
- package/build/cmd/generators/artifacts/indexFile.js +2 -1
- package/build/cmd/generators/artifacts/inputs.js +1 -2
- package/build/cmd/generators/artifacts/operations.d.ts +1 -1
- package/build/cmd/generators/artifacts/operations.js +3 -3
- package/build/cmd/generators/artifacts/selection.d.ts +1 -1
- package/build/cmd/generators/artifacts/selection.js +4 -6
- package/build/cmd/generators/artifacts/utils.js +3 -2
- package/build/cmd/generators/definitions/enums.js +7 -7
- package/build/cmd/generators/definitions/index.js +3 -3
- package/build/cmd/generators/index.d.ts +1 -0
- package/build/cmd/generators/index.js +3 -1
- package/build/cmd/generators/kit/index.d.ts +3 -0
- package/build/cmd/generators/kit/index.js +160 -0
- package/build/cmd/generators/persistedQueries/index.js +1 -2
- package/build/cmd/generators/runtime/adapter.js +2 -44
- package/build/cmd/generators/runtime/copyRuntime.js +79 -44
- package/build/cmd/generators/runtime/index.js +1 -6
- package/build/cmd/generators/runtime/indexFile.js +26 -4
- package/build/cmd/generators/stores/fragment.js +45 -26
- package/build/cmd/generators/stores/index.js +3 -3
- package/build/cmd/generators/stores/mutation.js +25 -16
- package/build/cmd/generators/stores/query.js +57 -54
- package/build/cmd/generators/stores/subscription.js +24 -45
- package/build/cmd/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/cmd/generators/typescript/addReferencedInputTypes.js +2 -4
- package/build/cmd/generators/typescript/index.js +9 -22
- package/build/cmd/generators/typescript/inlineType.d.ts +1 -1
- package/build/cmd/generators/typescript/inlineType.js +6 -8
- package/build/cmd/generators/typescript/typeReference.d.ts +1 -1
- package/build/cmd/generators/typescript/typeReference.js +1 -2
- package/build/cmd/generators/typescript/types.d.ts +2 -2
- package/build/cmd/generators/typescript/types.js +1 -2
- package/build/cmd/init.d.ts +1 -1
- package/build/cmd/init.js +203 -140
- package/build/cmd/main.js +33 -48
- package/build/cmd/pullSchema.d.ts +3 -0
- package/build/cmd/pullSchema.js +34 -0
- package/build/cmd/testUtils.d.ts +2 -2
- package/build/cmd/testUtils.js +3 -4
- package/build/cmd/transforms/addID.js +0 -2
- package/build/cmd/transforms/composeQueries.js +3 -3
- package/build/cmd/transforms/fragmentVariables.d.ts +1 -1
- package/build/cmd/transforms/fragmentVariables.js +17 -7
- package/build/cmd/transforms/list.js +3 -7
- package/build/cmd/transforms/paginate.js +3 -5
- package/build/cmd/transforms/schema.js +11 -5
- package/build/cmd/transforms/typename.js +0 -2
- package/build/cmd/types.d.ts +1 -10
- package/build/cmd/types.js +0 -2
- package/build/cmd/utils/cleanupFiles.js +4 -5
- package/build/cmd/utils/flattenSelections.js +3 -2
- package/build/cmd/utils/index.d.ts +1 -3
- package/build/cmd/utils/index.js +1 -3
- package/build/cmd/utils/introspection.d.ts +2 -0
- package/build/cmd/utils/{writeSchema.js โ introspection.js} +7 -15
- package/build/cmd/utils/moduleExport.d.ts +1 -1
- package/build/cmd/utils/moduleExport.js +1 -2
- package/build/cmd/utils/murmur.js +0 -1
- package/build/cmd/validators/forbiddenNames.d.ts +3 -0
- package/build/cmd/validators/forbiddenNames.js +33 -0
- package/build/cmd/validators/index.d.ts +1 -0
- package/build/cmd/validators/index.js +3 -1
- package/build/cmd/validators/noIDAlias.js +2 -4
- package/build/cmd/validators/typeCheck.d.ts +1 -1
- package/build/cmd/validators/typeCheck.js +37 -18
- package/build/cmd/validators/uniqueNames.js +8 -4
- package/build/cmd.js +159776 -109522
- package/build/common/config.d.ts +53 -11
- package/build/common/config.js +306 -112
- package/build/common/error.d.ts +9 -0
- package/build/common/error.js +18 -0
- package/build/common/extractLoadFunction.d.ts +4 -0
- package/build/common/extractLoadFunction.js +214 -0
- package/build/common/fs.d.ts +17 -0
- package/build/common/fs.js +144 -0
- package/build/common/graphql.d.ts +3 -1
- package/build/common/graphql.js +39 -10
- package/build/common/imports.d.ts +5 -2
- package/build/common/imports.js +2 -4
- package/build/common/index.d.ts +4 -0
- package/build/common/index.js +3 -0
- package/build/common/parse.d.ts +7 -5
- package/build/common/parse.js +35 -30
- package/build/common/pipeline.d.ts +1 -1
- package/build/common/pipeline.js +1 -1
- package/build/common/tests.d.ts +2 -3
- package/build/common/tests.js +5 -168
- package/build/common/types.d.ts +10 -5
- package/build/{preprocess/utils/walkTaggedDocuments.d.ts โ common/walk.d.ts} +6 -8
- package/build/{preprocess/utils/walkTaggedDocuments.js โ common/walk.js} +9 -45
- package/build/preprocess/index.d.ts +0 -1
- package/build/preprocess/index.js +51 -3
- package/build/preprocess-cjs/index.js +133267 -47217
- package/build/preprocess-esm/index.js +134778 -48734
- package/build/runtime/adapter.d.ts +0 -4
- package/build/runtime/adapter.js +1 -14
- package/build/runtime/cache/cache.d.ts +1 -1
- package/build/runtime/cache/cache.js +15 -15
- package/build/runtime/cache/stuff.d.ts +1 -1
- package/build/runtime/cache/subscription.d.ts +1 -1
- package/build/runtime/index.d.ts +2 -2
- package/build/runtime/index.js +16 -2
- package/build/runtime/inline/fragment.d.ts +6 -12
- package/build/runtime/inline/fragment.js +49 -78
- package/build/runtime/inline/index.d.ts +0 -3
- package/build/runtime/inline/index.js +1 -8
- package/build/runtime/lib/config.d.ts +46 -20
- package/build/runtime/lib/config.js +34 -1
- package/build/runtime/lib/context.d.ts +1 -3
- package/build/runtime/lib/context.js +3 -70
- package/build/runtime/lib/index.d.ts +6 -1
- package/build/runtime/lib/index.js +49 -3
- package/build/runtime/lib/network.d.ts +19 -32
- package/build/runtime/lib/network.js +53 -169
- package/build/runtime/lib/scalars.d.ts +5 -7
- package/build/runtime/lib/scalars.js +13 -10
- package/build/runtime/lib/test.d.ts +4 -0
- package/build/runtime/lib/test.js +189 -0
- package/build/runtime/lib/types.d.ts +15 -135
- package/build/runtime/lib/types.js +5 -5
- package/build/runtime/stores/fragment.d.ts +17 -10
- package/build/runtime/stores/fragment.js +25 -79
- package/build/runtime/stores/index.d.ts +5 -4
- package/build/runtime/stores/index.js +23 -8
- package/build/runtime/stores/mutation.d.ts +28 -4
- package/build/runtime/stores/mutation.js +45 -52
- package/build/runtime/stores/pagination/cursor.d.ts +29 -0
- package/build/runtime/stores/pagination/cursor.js +162 -0
- package/build/runtime/stores/pagination/fetch.d.ts +3 -0
- package/build/runtime/stores/pagination/fetch.js +2 -0
- package/build/runtime/stores/pagination/fragment.d.ts +154 -0
- package/build/runtime/stores/pagination/fragment.js +144 -0
- package/build/runtime/stores/pagination/index.d.ts +2 -0
- package/build/runtime/stores/pagination/index.js +11 -0
- package/build/runtime/stores/pagination/offset.d.ts +28 -0
- package/build/runtime/stores/pagination/offset.js +98 -0
- package/build/runtime/stores/pagination/pageInfo.d.ts +13 -0
- package/build/runtime/stores/pagination/pageInfo.js +54 -0
- package/build/runtime/stores/pagination/query.d.ts +42 -0
- package/build/runtime/stores/pagination/query.js +75 -0
- package/build/runtime/stores/query.d.ts +102 -24
- package/build/runtime/stores/query.js +246 -351
- package/build/runtime/stores/store.d.ts +2 -0
- package/build/runtime/stores/store.js +6 -0
- package/build/runtime/stores/subscription.d.ts +15 -4
- package/build/runtime/stores/subscription.js +80 -79
- package/build/runtime-cjs/adapter.d.ts +0 -4
- package/build/runtime-cjs/adapter.js +1 -14
- package/build/runtime-cjs/cache/cache.d.ts +1 -1
- package/build/runtime-cjs/cache/cache.js +15 -15
- package/build/runtime-cjs/cache/stuff.d.ts +1 -1
- package/build/runtime-cjs/cache/subscription.d.ts +1 -1
- package/build/runtime-cjs/index.d.ts +2 -2
- package/build/runtime-cjs/index.js +16 -2
- package/build/runtime-cjs/inline/fragment.d.ts +6 -12
- package/build/runtime-cjs/inline/fragment.js +49 -78
- package/build/runtime-cjs/inline/index.d.ts +0 -3
- package/build/runtime-cjs/inline/index.js +1 -8
- package/build/runtime-cjs/lib/config.d.ts +46 -20
- package/build/runtime-cjs/lib/config.js +34 -1
- package/build/runtime-cjs/lib/context.d.ts +1 -3
- package/build/runtime-cjs/lib/context.js +3 -70
- package/build/runtime-cjs/lib/index.d.ts +6 -1
- package/build/runtime-cjs/lib/index.js +49 -3
- package/build/runtime-cjs/lib/network.d.ts +19 -32
- package/build/runtime-cjs/lib/network.js +53 -169
- package/build/runtime-cjs/lib/scalars.d.ts +5 -7
- package/build/runtime-cjs/lib/scalars.js +13 -10
- package/build/runtime-cjs/lib/test.d.ts +4 -0
- package/build/runtime-cjs/lib/test.js +189 -0
- package/build/runtime-cjs/lib/types.d.ts +15 -135
- package/build/runtime-cjs/lib/types.js +5 -5
- package/build/runtime-cjs/meta.json +1 -0
- package/build/runtime-cjs/stores/fragment.d.ts +17 -10
- package/build/runtime-cjs/stores/fragment.js +25 -79
- package/build/runtime-cjs/stores/index.d.ts +5 -4
- package/build/runtime-cjs/stores/index.js +23 -8
- package/build/runtime-cjs/stores/mutation.d.ts +28 -4
- package/build/runtime-cjs/stores/mutation.js +45 -52
- package/build/runtime-cjs/stores/pagination/cursor.d.ts +29 -0
- package/build/runtime-cjs/stores/pagination/cursor.js +162 -0
- package/build/runtime-cjs/stores/pagination/fetch.d.ts +3 -0
- package/build/{preprocess/types.js โ runtime-cjs/stores/pagination/fetch.js} +0 -0
- package/build/runtime-cjs/stores/pagination/fragment.d.ts +154 -0
- package/build/runtime-cjs/stores/pagination/fragment.js +144 -0
- package/build/runtime-cjs/stores/pagination/index.d.ts +2 -0
- package/build/runtime-cjs/stores/pagination/index.js +11 -0
- package/build/runtime-cjs/stores/pagination/offset.d.ts +28 -0
- package/build/runtime-cjs/stores/pagination/offset.js +98 -0
- package/build/runtime-cjs/stores/pagination/pageInfo.d.ts +13 -0
- package/build/runtime-cjs/stores/pagination/pageInfo.js +54 -0
- package/build/runtime-cjs/stores/pagination/query.d.ts +42 -0
- package/build/runtime-cjs/stores/pagination/query.js +75 -0
- package/build/runtime-cjs/stores/query.d.ts +102 -24
- package/build/runtime-cjs/stores/query.js +246 -351
- package/build/runtime-cjs/stores/store.d.ts +2 -0
- package/build/runtime-cjs/stores/store.js +6 -0
- package/build/runtime-cjs/stores/subscription.d.ts +15 -4
- package/build/runtime-cjs/stores/subscription.js +80 -79
- package/build/runtime-esm/adapter.d.ts +0 -4
- package/build/runtime-esm/adapter.js +0 -11
- package/build/runtime-esm/cache/cache.d.ts +1 -1
- package/build/runtime-esm/cache/cache.js +15 -15
- package/build/runtime-esm/cache/stuff.d.ts +1 -1
- package/build/runtime-esm/cache/subscription.d.ts +1 -1
- package/build/runtime-esm/index.d.ts +2 -2
- package/build/runtime-esm/index.js +17 -2
- package/build/runtime-esm/inline/fragment.d.ts +6 -12
- package/build/runtime-esm/inline/fragment.js +26 -79
- package/build/runtime-esm/inline/index.d.ts +0 -3
- package/build/runtime-esm/inline/index.js +0 -3
- package/build/runtime-esm/lib/config.d.ts +46 -20
- package/build/runtime-esm/lib/config.js +9 -0
- package/build/runtime-esm/lib/context.d.ts +1 -3
- package/build/runtime-esm/lib/context.js +2 -45
- package/build/runtime-esm/lib/index.d.ts +6 -1
- package/build/runtime-esm/lib/index.js +47 -1
- package/build/runtime-esm/lib/network.d.ts +19 -32
- package/build/runtime-esm/lib/network.js +51 -165
- package/build/runtime-esm/lib/scalars.d.ts +5 -7
- package/build/runtime-esm/lib/scalars.js +13 -10
- package/build/runtime-esm/lib/test.d.ts +4 -0
- package/build/runtime-esm/lib/test.js +183 -0
- package/build/runtime-esm/lib/types.d.ts +15 -135
- package/build/runtime-esm/lib/types.js +4 -4
- package/build/runtime-esm/meta.json +1 -0
- package/build/runtime-esm/stores/fragment.d.ts +17 -10
- package/build/runtime-esm/stores/fragment.js +24 -78
- package/build/runtime-esm/stores/index.d.ts +5 -4
- package/build/runtime-esm/stores/index.js +5 -4
- package/build/runtime-esm/stores/mutation.d.ts +28 -4
- package/build/runtime-esm/stores/mutation.js +45 -52
- package/build/runtime-esm/stores/pagination/cursor.d.ts +29 -0
- package/build/runtime-esm/stores/pagination/cursor.js +156 -0
- package/build/runtime-esm/stores/pagination/fetch.d.ts +3 -0
- package/build/{preprocess/test.d.ts โ runtime-esm/stores/pagination/fetch.js} +0 -0
- package/build/runtime-esm/stores/pagination/fragment.d.ts +154 -0
- package/build/runtime-esm/stores/pagination/fragment.js +139 -0
- package/build/runtime-esm/stores/pagination/index.d.ts +2 -0
- package/build/runtime-esm/stores/pagination/index.js +2 -0
- package/build/runtime-esm/stores/pagination/offset.d.ts +28 -0
- package/build/runtime-esm/stores/pagination/offset.js +92 -0
- package/build/runtime-esm/stores/pagination/pageInfo.d.ts +13 -0
- package/build/runtime-esm/stores/pagination/pageInfo.js +48 -0
- package/build/runtime-esm/stores/pagination/query.d.ts +42 -0
- package/build/runtime-esm/stores/pagination/query.js +69 -0
- package/build/runtime-esm/stores/query.d.ts +102 -24
- package/build/runtime-esm/stores/query.js +247 -350
- package/build/runtime-esm/stores/store.d.ts +2 -0
- package/build/runtime-esm/stores/store.js +2 -0
- package/build/runtime-esm/stores/subscription.d.ts +15 -4
- package/build/runtime-esm/stores/subscription.js +79 -77
- package/build/vite/ast.d.ts +7 -0
- package/build/vite/ast.js +21 -0
- package/build/vite/fsPatch.d.ts +2 -0
- package/build/vite/fsPatch.js +146 -0
- package/build/vite/imports.d.ts +48 -0
- package/build/vite/imports.js +83 -0
- package/build/vite/index.d.ts +5 -0
- package/build/vite/index.js +55 -0
- package/build/vite/manifest.d.ts +3 -0
- package/build/vite/manifest.js +60 -0
- package/build/vite/plugin.d.ts +10 -0
- package/build/vite/plugin.js +61 -0
- package/build/vite/schema.d.ts +2 -0
- package/build/vite/schema.js +60 -0
- package/build/vite/tests.d.ts +16 -0
- package/build/vite/tests.js +88 -0
- package/build/vite/transforms/index.d.ts +5 -0
- package/build/vite/transforms/index.js +105 -0
- package/build/vite/transforms/kit.d.ts +3 -0
- package/build/vite/transforms/kit.js +303 -0
- package/build/vite/transforms/query.d.ts +11 -0
- package/build/vite/transforms/query.js +177 -0
- package/build/vite/transforms/reactive.d.ts +3 -0
- package/build/vite/transforms/reactive.js +117 -0
- package/build/vite/transforms/tags.d.ts +3 -0
- package/build/{preprocess/utils/identifiers.js โ vite/transforms/tags.js} +20 -4
- package/build/vite/watch-and-run.d.ts +45 -0
- package/build/vite/watch-and-run.js +148 -0
- package/build/vite-cjs/index.js +162495 -0
- package/build/vite-esm/index.js +162456 -0
- package/package.json +133 -112
- package/pnpm-workspace.yaml +1 -0
- package/rollup.config.js +12 -11
- package/runtimeMeta.js +11 -0
- package/site/package.json +11 -12
- package/site/src/app.d.ts +2 -5
- package/site/src/components/APIShowcase.svelte +7 -5
- package/site/src/components/Highlight.svelte +12 -0
- package/site/src/components/index.js +1 -1
- package/site/src/lib/highlight.js +663 -4
- package/site/src/lib/loadContent.js +81 -90
- package/site/src/lib/loadOutline.js +78 -96
- package/site/src/routes/_content.js +1 -1
- package/site/src/routes/_page.svelte +2 -4
- package/site/src/routes/api/cli.svx +17 -4
- package/site/src/routes/api/config.svx +19 -17
- package/site/src/routes/api/{fragment/inline.svx โ fragments.svx} +53 -34
- package/site/src/routes/api/graphql.svx +7 -11
- package/site/src/routes/api/{mutation/inline.svx โ mutation.svx} +76 -51
- package/site/src/routes/api/routes.svx +447 -0
- package/site/src/routes/api/{subscription/inline.svx โ subscription.svx} +61 -8
- package/site/src/routes/api/vite.svx +34 -0
- package/site/src/routes/api/welcome.svx +23 -25
- package/site/src/routes/guides/authentication.svx +1 -1
- package/site/src/routes/guides/caching-data.svx +2 -2
- package/site/src/routes/guides/contributing.svx +73 -13
- package/site/src/routes/guides/faq.svx +42 -38
- package/site/src/routes/guides/migrating-to-016.svx +281 -0
- package/site/src/routes/guides/pagination.svx +69 -42
- package/site/src/routes/guides/persisted-queries.svx +4 -4
- package/site/src/routes/guides/release-notes.svx +308 -0
- package/site/src/routes/guides/setting-up-your-project.svx +35 -59
- package/site/src/routes/guides/typescript.svx +59 -49
- package/site/src/routes/guides/working-with-graphql.svx +377 -108
- package/site/src/routes/index.svelte +16 -22
- package/site/src/routes/intro/fetching-data.svx +41 -50
- package/site/src/routes/intro/fragments.svx +47 -63
- package/site/src/routes/intro/mutations.svx +6 -8
- package/site/src/routes/intro/pagination.svx +18 -23
- package/site/static/styles/code.css +453 -61
- package/site/static/styles/md.css +11 -4
- package/site/svelte.config.js +2 -29
- package/site/vite.config.js +2 -5
- package/src/cmd/generate.ts +246 -115
- package/src/cmd/generators/artifacts/fieldKey.ts +4 -4
- package/src/cmd/generators/artifacts/index.ts +28 -26
- package/src/cmd/generators/artifacts/indexFile.ts +4 -5
- package/src/cmd/generators/artifacts/inputs.ts +3 -4
- package/src/cmd/generators/artifacts/operations.ts +5 -5
- package/src/cmd/generators/artifacts/selection.ts +8 -9
- package/src/cmd/generators/artifacts/utils.ts +4 -2
- package/src/cmd/generators/definitions/enums.ts +12 -11
- package/src/cmd/generators/definitions/index.ts +1 -4
- package/src/cmd/generators/index.ts +1 -0
- package/src/cmd/generators/kit/index.ts +162 -0
- package/src/cmd/generators/persistedQueries/index.ts +3 -3
- package/src/cmd/generators/runtime/adapter.ts +2 -47
- package/src/cmd/generators/runtime/copyRuntime.ts +72 -56
- package/src/cmd/generators/runtime/index.ts +1 -7
- package/src/cmd/generators/runtime/indexFile.ts +5 -5
- package/src/cmd/generators/stores/fragment.ts +49 -33
- package/src/cmd/generators/stores/index.ts +2 -3
- package/src/cmd/generators/stores/mutation.ts +25 -15
- package/src/cmd/generators/stores/query.ts +59 -33
- package/src/cmd/generators/stores/subscription.ts +25 -24
- package/src/cmd/generators/typescript/addReferencedInputTypes.ts +5 -6
- package/src/cmd/generators/typescript/index.ts +12 -68
- package/src/cmd/generators/typescript/inlineType.ts +15 -14
- package/src/cmd/generators/typescript/typeReference.ts +3 -4
- package/src/cmd/generators/typescript/types.ts +3 -3
- package/src/cmd/init.ts +193 -138
- package/src/cmd/main.ts +53 -62
- package/src/cmd/pullSchema.ts +41 -0
- package/src/cmd/testUtils.ts +7 -9
- package/src/cmd/transforms/addID.ts +1 -2
- package/src/cmd/transforms/composeQueries.ts +4 -5
- package/src/cmd/transforms/fragmentVariables.ts +18 -10
- package/src/cmd/transforms/list.ts +108 -106
- package/src/cmd/transforms/paginate.ts +36 -36
- package/src/cmd/transforms/schema.ts +14 -7
- package/src/cmd/transforms/typename.ts +1 -2
- package/src/cmd/types.ts +2 -12
- package/src/cmd/utils/cleanupFiles.ts +3 -3
- package/src/cmd/utils/flattenSelections.ts +4 -5
- package/src/cmd/utils/graphql.ts +1 -0
- package/src/cmd/utils/index.ts +1 -3
- package/src/cmd/utils/{writeSchema.ts โ introspection.ts} +7 -11
- package/src/cmd/utils/moduleExport.ts +3 -4
- package/src/cmd/utils/murmur.ts +0 -1
- package/src/cmd/validators/forbiddenNames.ts +45 -0
- package/src/cmd/validators/index.ts +1 -0
- package/src/cmd/validators/noIDAlias.ts +10 -9
- package/src/cmd/validators/typeCheck.ts +69 -36
- package/src/cmd/validators/uniqueNames.ts +14 -9
- package/src/common/config.ts +414 -135
- package/src/common/error.ts +24 -0
- package/src/common/extractLoadFunction.ts +246 -0
- package/src/common/fs.ts +155 -0
- package/src/common/graphql.ts +46 -9
- package/src/common/imports.ts +11 -9
- package/src/common/index.ts +5 -0
- package/src/common/parse.ts +38 -37
- package/src/common/pipeline.ts +4 -3
- package/src/common/tests.ts +4 -167
- package/src/common/types.ts +12 -5
- package/src/{preprocess/utils/walkTaggedDocuments.ts โ common/walk.ts} +15 -60
- package/src/preprocess/index.ts +31 -3
- package/src/runtime/adapter.ts +0 -12
- package/src/runtime/cache/cache.ts +16 -17
- package/src/runtime/cache/lists.ts +0 -1
- package/src/runtime/cache/stuff.ts +1 -1
- package/src/runtime/cache/subscription.ts +2 -2
- package/src/runtime/index.ts +18 -3
- package/src/runtime/inline/fragment.ts +48 -119
- package/src/runtime/inline/index.ts +0 -3
- package/src/runtime/lib/config.ts +62 -21
- package/src/runtime/lib/context.ts +2 -50
- package/src/runtime/lib/index.ts +68 -1
- package/src/runtime/lib/network.ts +72 -251
- package/src/runtime/lib/scalars.ts +68 -63
- package/src/runtime/lib/test.ts +189 -0
- package/src/runtime/lib/types.ts +30 -176
- package/src/runtime/stores/fragment.ts +39 -119
- package/src/runtime/stores/index.ts +5 -4
- package/src/runtime/stores/mutation.ts +72 -69
- package/src/runtime/stores/pagination/cursor.ts +257 -0
- package/src/runtime/stores/pagination/fetch.ts +6 -0
- package/src/runtime/stores/pagination/fragment.ts +232 -0
- package/src/runtime/stores/pagination/index.ts +7 -0
- package/src/runtime/stores/pagination/offset.ts +152 -0
- package/src/runtime/stores/pagination/pageInfo.ts +67 -0
- package/src/runtime/stores/pagination/query.ts +130 -0
- package/src/runtime/stores/query.ts +392 -458
- package/src/runtime/stores/store.ts +3 -0
- package/src/runtime/stores/subscription.ts +88 -89
- package/src/vite/ast.ts +29 -0
- package/src/vite/fsPatch.ts +141 -0
- package/src/vite/imports.ts +141 -0
- package/src/vite/index.ts +62 -0
- package/src/vite/manifest.ts +44 -0
- package/src/vite/plugin.ts +75 -0
- package/src/vite/schema.ts +73 -0
- package/src/vite/tests.ts +147 -0
- package/src/vite/transforms/index.ts +93 -0
- package/src/vite/transforms/kit.ts +452 -0
- package/src/vite/transforms/query.ts +262 -0
- package/src/vite/transforms/reactive.ts +122 -0
- package/src/vite/transforms/tags.ts +30 -0
- package/src/vite/watch-and-run.ts +224 -0
- package/typeModule.js +19 -0
- package/vite.config.ts +9 -0
- package/{jest.d.ts โ vite.d.ts} +1 -1
- package/{jest.setup.js โ vitest.setup.ts} +32 -28
- package/.yarnrc.yml +0 -3
- package/build/cmd/generators/runtime/meta.d.ts +0 -2
- package/build/cmd/generators/runtime/meta.js +0 -10
- package/build/cmd/generators/stores/pagination.d.ts +0 -8
- package/build/cmd/generators/stores/pagination.js +0 -50
- package/build/cmd/utils/readFile.d.ts +0 -1
- package/build/cmd/utils/readFile.js +0 -15
- package/build/cmd/utils/writeFile.d.ts +0 -1
- package/build/cmd/utils/writeFile.js +0 -16
- package/build/cmd/utils/writeSchema.d.ts +0 -2
- package/build/preprocess/test.js +0 -255
- package/build/preprocess/transforms/fragment.d.ts +0 -3
- package/build/preprocess/transforms/fragment.js +0 -122
- package/build/preprocess/transforms/index.d.ts +0 -9
- package/build/preprocess/transforms/index.js +0 -130
- package/build/preprocess/transforms/module.d.ts +0 -3
- package/build/preprocess/transforms/module.js +0 -49
- package/build/preprocess/transforms/mutation.d.ts +0 -3
- package/build/preprocess/transforms/mutation.js +0 -63
- package/build/preprocess/transforms/query.d.ts +0 -3
- package/build/preprocess/transforms/query.js +0 -463
- package/build/preprocess/transforms/subscription.d.ts +0 -3
- package/build/preprocess/transforms/subscription.js +0 -71
- package/build/preprocess/types.d.ts +0 -8
- package/build/preprocess/utils/artifactIdentifier.d.ts +0 -3
- package/build/preprocess/utils/artifactIdentifier.js +0 -6
- package/build/preprocess/utils/identifiers.d.ts +0 -4
- package/build/preprocess/utils/index.d.ts +0 -4
- package/build/preprocess/utils/index.js +0 -25
- package/build/preprocess/utils/preprocessorTest.d.ts +0 -8
- package/build/preprocess/utils/preprocessorTest.js +0 -61
- package/build/runtime/inline/mutation.d.ts +0 -5
- package/build/runtime/inline/mutation.js +0 -21
- package/build/runtime/inline/query.d.ts +0 -21
- package/build/runtime/inline/query.js +0 -47
- package/build/runtime/inline/subscription.d.ts +0 -5
- package/build/runtime/inline/subscription.js +0 -27
- package/build/runtime/lib/pagination.d.ts +0 -88
- package/build/runtime/lib/pagination.js +0 -463
- package/build/runtime/lib/session.d.ts +0 -9
- package/build/runtime/lib/session.js +0 -47
- package/build/runtime-cjs/inline/mutation.d.ts +0 -5
- package/build/runtime-cjs/inline/mutation.js +0 -21
- package/build/runtime-cjs/inline/query.d.ts +0 -21
- package/build/runtime-cjs/inline/query.js +0 -47
- package/build/runtime-cjs/inline/subscription.d.ts +0 -5
- package/build/runtime-cjs/inline/subscription.js +0 -27
- package/build/runtime-cjs/lib/pagination.d.ts +0 -88
- package/build/runtime-cjs/lib/pagination.js +0 -463
- package/build/runtime-cjs/lib/session.d.ts +0 -9
- package/build/runtime-cjs/lib/session.js +0 -47
- package/build/runtime-esm/inline/mutation.d.ts +0 -5
- package/build/runtime-esm/inline/mutation.js +0 -17
- package/build/runtime-esm/inline/query.d.ts +0 -21
- package/build/runtime-esm/inline/query.js +0 -42
- package/build/runtime-esm/inline/subscription.d.ts +0 -5
- package/build/runtime-esm/inline/subscription.js +0 -23
- package/build/runtime-esm/lib/pagination.d.ts +0 -88
- package/build/runtime-esm/lib/pagination.js +0 -458
- package/build/runtime-esm/lib/session.d.ts +0 -9
- package/build/runtime-esm/lib/session.js +0 -42
- package/jest.config.js +0 -19
- package/site/src/components/HeaderWithMode.svelte +0 -53
- package/site/src/hooks.ts +0 -11
- package/site/src/lib/graphql-language.js +0 -45
- package/site/src/lib/mode.js +0 -20
- package/site/src/routes/api/fragment/store.svx +0 -166
- package/site/src/routes/api/mutation/store.svx +0 -99
- package/site/src/routes/api/preprocessor.svx +0 -30
- package/site/src/routes/api/query/inline.svx +0 -219
- package/site/src/routes/api/query/store.svx +0 -299
- package/site/src/routes/api/subscription/store.svx +0 -37
- package/site/src/routes/guides/migrating-to-0.15.0.svx +0 -92
- package/site/src/routes/setMode.ts +0 -12
- package/site/src/sections/subscription-client.svx +0 -93
- package/src/cmd/generators/runtime/meta.ts +0 -13
- package/src/cmd/generators/stores/pagination.ts +0 -60
- package/src/cmd/utils/readFile.ts +0 -8
- package/src/cmd/utils/writeFile.ts +0 -10
- package/src/preprocess/test.ts +0 -272
- package/src/preprocess/transforms/fragment.ts +0 -137
- package/src/preprocess/transforms/index.ts +0 -168
- package/src/preprocess/transforms/module.ts +0 -39
- package/src/preprocess/transforms/mutation.ts +0 -49
- package/src/preprocess/transforms/query.ts +0 -835
- package/src/preprocess/transforms/subscription.ts +0 -60
- package/src/preprocess/types.ts +0 -10
- package/src/preprocess/utils/artifactIdentifier.ts +0 -3
- package/src/preprocess/utils/identifiers.ts +0 -7
- package/src/preprocess/utils/index.ts +0 -4
- package/src/preprocess/utils/preprocessorTest.ts +0 -44
- package/src/runtime/inline/mutation.ts +0 -28
- package/src/runtime/inline/query.ts +0 -69
- package/src/runtime/inline/subscription.ts +0 -38
- package/src/runtime/lib/pagination.ts +0 -680
- package/src/runtime/lib/session.ts +0 -60
- package/typeModule.sh +0 -25
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: '@theguild',
|
|
4
|
+
rules: {
|
|
5
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
6
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
7
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
8
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
9
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
10
|
+
'@typescript-eslint/ban-types': 'off',
|
|
11
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
12
|
+
'@typescript-eslint/prefer-as-const': 'off',
|
|
13
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
14
|
+
'unicorn/no-lonely-if': 'off',
|
|
15
|
+
'unicorn/filename-case': 'off',
|
|
16
|
+
'unicorn/no-instanceof-array': 'off',
|
|
17
|
+
'unicorn/prefer-includes': 'off',
|
|
18
|
+
'import/no-default-export': 'off',
|
|
19
|
+
'sonarjs/no-gratuitous-expressions': 'off',
|
|
20
|
+
'no-lonely-if': 'off',
|
|
21
|
+
'no-console': 'off',
|
|
22
|
+
'prefer-arrow-callback': 'off',
|
|
23
|
+
'prefer-const': 'off',
|
|
24
|
+
'no-else-return': 'off',
|
|
25
|
+
'no-empty': 'off',
|
|
26
|
+
'no-var': 'off',
|
|
27
|
+
'no-undef': 'off',
|
|
28
|
+
'object-shorthand': 'off',
|
|
29
|
+
// 'no-console': ['error', { allow: ['info', 'warn', 'error', 'time', 'timeEnd'] }],
|
|
30
|
+
},
|
|
31
|
+
ignorePatterns: ['integration', 'example', 'site'],
|
|
32
|
+
parserOptions: {
|
|
33
|
+
sourceType: 'module',
|
|
34
|
+
ecmaVersion: 2020,
|
|
35
|
+
},
|
|
36
|
+
}
|
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/.prettierignore
CHANGED
package/.prettierrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# houdini
|
|
2
2
|
|
|
3
|
+
## 0.16.0-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#483](https://github.com/HoudiniGraphql/houdini/pull/483) [`a69138a`](https://github.com/HoudiniGraphql/houdini/commit/a69138ae2908b0517cdbfe8b544b634e6f96df53) Thanks [@jycouet](https://github.com/jycouet)! - fix: check field existence before @list directive to have better error msg
|
|
8
|
+
|
|
9
|
+
## 0.16.0-next.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#479](https://github.com/HoudiniGraphql/houdini/pull/479) [`9a9d376`](https://github.com/HoudiniGraphql/houdini/commit/9a9d376d7d707889a5ca77a5b98ebddcef7d6272) Thanks [@janvotava](https://github.com/janvotava)! - fix readDirSync patch (fixing file.isDirectory is not a function)
|
|
14
|
+
|
|
15
|
+
## 0.16.0-next.0
|
|
16
|
+
|
|
17
|
+
### โ ๏ธ Breaking Changes
|
|
18
|
+
|
|
19
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - remove inline document functions query, paginatedQuery, subscription, and mutation
|
|
20
|
+
|
|
21
|
+
* [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - renamed `generate --pull-header` to `generate --header` and `generate --persist-output` to `generate --output`
|
|
22
|
+
|
|
23
|
+
* [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - inverted argument order for inline fragments
|
|
24
|
+
|
|
25
|
+
* [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - Stores are now classes and need to be instantiated with `new MyQueryStore()`
|
|
26
|
+
|
|
27
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - query stores must now be passed to routes as props instead of globally imported
|
|
28
|
+
|
|
29
|
+
* [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - SvelteKit projects must now use `houdini/kit` as a vite plugin
|
|
30
|
+
|
|
31
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - `config.sourceGlob` has been renamed to `config.include` and is now optional. Also added `config.exclude` to filter out files matched by `config.include`
|
|
32
|
+
|
|
33
|
+
### โจ Features
|
|
34
|
+
|
|
35
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - added support for page queries
|
|
36
|
+
|
|
37
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@jycouet](https://github.com/jycouet)! - You can now define the prefix of your global stores with globalStorePrefix param in the config.
|
|
38
|
+
|
|
39
|
+
* [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - graphql tags return store references
|
|
40
|
+
|
|
41
|
+
- [#449](https://github.com/HoudiniGraphql/houdini/pull/449) [`59257d1`](https://github.com/HoudiniGraphql/houdini/commit/59257d1dffa6c1d9d250ba0964c6f1f0c35da048) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - add generated typedefs for route functions
|
|
42
|
+
|
|
3
43
|
## 0.15.9
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<br />
|
|
6
6
|
|
|
7
7
|
<strong>
|
|
8
|
-
The disappearing GraphQL client for
|
|
8
|
+
The disappearing GraphQL client for SvelteKit.
|
|
9
9
|
</strong>
|
|
10
10
|
<br />
|
|
11
11
|
<br />
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
|
|
15
15
|
```svelte
|
|
16
16
|
<script>
|
|
17
|
-
|
|
17
|
+
// src/routes/items/+page.svelte
|
|
18
|
+
import { graphql } from '$houdini'
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
-
query
|
|
20
|
+
const AllItems = graphql`
|
|
21
|
+
query AllItems {
|
|
21
22
|
items {
|
|
22
23
|
text
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
`
|
|
26
|
+
`
|
|
26
27
|
</script>
|
|
27
28
|
|
|
28
|
-
{#each $data.items as item}
|
|
29
|
+
{#each $AllItems.data.items as item}
|
|
29
30
|
<div>{item.text}</div>
|
|
30
31
|
{/each}
|
|
31
32
|
```
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
- Normalized cache with declarative updates
|
|
37
38
|
- Generated types
|
|
38
39
|
- Subscriptions
|
|
39
|
-
- Support for SvelteKit
|
|
40
|
+
- Support for SvelteKit
|
|
40
41
|
- Pagination (cursors **and** offsets)
|
|
41
42
|
|
|
42
43
|
At its core, houdini seeks to enable a high quality developer experience
|
package/build/cmd/generate.js
CHANGED
|
@@ -27,17 +27,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.runPipeline = void 0;
|
|
30
|
-
// externals
|
|
31
30
|
const glob_1 = __importDefault(require("glob"));
|
|
32
|
-
const svelte = __importStar(require("svelte/compiler"));
|
|
33
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
34
31
|
const graphql = __importStar(require("graphql"));
|
|
32
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
34
|
+
const svelte = __importStar(require("svelte/compiler"));
|
|
35
35
|
const util_1 = require("util");
|
|
36
|
-
// locals
|
|
37
36
|
const common_1 = require("../common");
|
|
38
|
-
const types_1 = require("./types");
|
|
39
|
-
const transforms = __importStar(require("./transforms"));
|
|
40
37
|
const generators = __importStar(require("./generators"));
|
|
38
|
+
const transforms = __importStar(require("./transforms"));
|
|
39
|
+
const types_1 = require("./types");
|
|
41
40
|
const validators = __importStar(require("./validators"));
|
|
42
41
|
// the main entry point of the compile script
|
|
43
42
|
async function compile(config) {
|
|
@@ -65,92 +64,116 @@ async function runPipeline(config, docs) {
|
|
|
65
64
|
new: [],
|
|
66
65
|
deleted: [],
|
|
67
66
|
};
|
|
68
|
-
// notify the user we are starting the generation process
|
|
69
|
-
if (config.logLevel !== common_1.LogLevel.Quiet) {
|
|
70
|
-
console.log('๐ฉ Generating runtime...');
|
|
71
|
-
}
|
|
72
67
|
// the last version the runtime was generated with
|
|
73
68
|
let previousVersion = '';
|
|
69
|
+
let newClientPath = false;
|
|
70
|
+
let newTimestamp = false;
|
|
71
|
+
const content = await (0, common_1.readFile)(config.metaFilePath);
|
|
72
|
+
if (content) {
|
|
73
|
+
try {
|
|
74
|
+
const parsed = JSON.parse(content);
|
|
75
|
+
previousVersion = parsed.version + parsed.createdOn;
|
|
76
|
+
newClientPath = parsed.client !== config.client;
|
|
77
|
+
// look up the source metadata (so we can figure out if the version actually changed)
|
|
78
|
+
const sourceMeta = await (0, common_1.readFile)(path_1.default.join(config.runtimeSource, 'meta.json'));
|
|
79
|
+
if (!sourceMeta) {
|
|
80
|
+
throw new Error('skip');
|
|
81
|
+
}
|
|
82
|
+
// if the two timestamps are not the same, we have a new version
|
|
83
|
+
newTimestamp = JSON.parse(sourceMeta).timestamp !== parsed.timestamp;
|
|
84
|
+
}
|
|
85
|
+
catch { }
|
|
86
|
+
}
|
|
87
|
+
// generate the runtime if the version changed, if its a new project, or they changed their client path
|
|
88
|
+
const generateRuntime = newTimestamp || newClientPath || !previousVersion;
|
|
89
|
+
// run the generate command before we print "๐ฉ Generating runtime..." because we don't know upfront artifactStats.
|
|
90
|
+
let error = null;
|
|
74
91
|
try {
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
await (0, common_1.runPipeline)(config, [
|
|
93
|
+
// validators
|
|
94
|
+
validators.typeCheck,
|
|
95
|
+
validators.uniqueNames,
|
|
96
|
+
validators.noIDAlias,
|
|
97
|
+
validators.forbiddenNames,
|
|
98
|
+
// transforms
|
|
99
|
+
transforms.internalSchema,
|
|
100
|
+
transforms.addID,
|
|
101
|
+
transforms.typename,
|
|
102
|
+
// list transform must go before fragment variables
|
|
103
|
+
// so that the mutation fragments are defined before they get mixed in
|
|
104
|
+
transforms.list,
|
|
105
|
+
// paginate transform needs to go before fragmentVariables
|
|
106
|
+
// so that the variable definitions get hashed
|
|
107
|
+
transforms.paginate,
|
|
108
|
+
transforms.fragmentVariables,
|
|
109
|
+
transforms.composeQueries,
|
|
110
|
+
// generators
|
|
111
|
+
// the runtime is a static thing most of the time. It only needs to be regenerated if
|
|
112
|
+
// the user is upgrading versions or the client path changed
|
|
113
|
+
generateRuntime ? generators.runtime : null,
|
|
114
|
+
generators.artifacts(artifactStats),
|
|
115
|
+
generators.typescript,
|
|
116
|
+
generators.persistOutput,
|
|
117
|
+
generators.definitions,
|
|
118
|
+
generators.stores,
|
|
119
|
+
// this has to go after runtime and artifacts
|
|
120
|
+
generators.kit,
|
|
121
|
+
], docs);
|
|
77
122
|
}
|
|
78
|
-
catch {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// so that the variable definitions get hashed
|
|
95
|
-
transforms.paginate,
|
|
96
|
-
transforms.fragmentVariables,
|
|
97
|
-
transforms.composeQueries,
|
|
98
|
-
// generators
|
|
99
|
-
generators.runtime,
|
|
100
|
-
generators.artifacts(artifactStats),
|
|
101
|
-
generators.typescript,
|
|
102
|
-
generators.persistOutput,
|
|
103
|
-
generators.definitions,
|
|
104
|
-
generators.stores,
|
|
105
|
-
], docs);
|
|
106
|
-
// don't log anything if its quiet
|
|
107
|
-
if (config.logLevel === common_1.LogLevel.Quiet) {
|
|
123
|
+
catch (e) {
|
|
124
|
+
error = e;
|
|
125
|
+
}
|
|
126
|
+
/// Summary
|
|
127
|
+
// count the number of unchanged
|
|
128
|
+
const unchanged = artifactStats.total.length -
|
|
129
|
+
artifactStats.changed.length -
|
|
130
|
+
artifactStats.new.length -
|
|
131
|
+
artifactStats.deleted.length;
|
|
132
|
+
// If triggered from the plugin, we show logs ONLY if there are changes.
|
|
133
|
+
const printMessage = !config.plugin || unchanged !== artifactStats.total.length;
|
|
134
|
+
if (!printMessage || config.logLevel === common_1.LogLevel.Quiet) {
|
|
135
|
+
if (error) {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
108
139
|
}
|
|
109
|
-
|
|
140
|
+
if (!config.plugin) {
|
|
141
|
+
console.log('๐ฉ Generating runtime...');
|
|
142
|
+
}
|
|
143
|
+
if (error) {
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
// if we detected a version change, we're nuking everything so don't bother with a summary
|
|
147
|
+
if (newTimestamp) {
|
|
110
148
|
console.log('๐ฃ Detected new version of Houdini. Regenerating all documents...');
|
|
111
149
|
console.log('๐ Welcome to HOUDINI_VERSION!');
|
|
112
150
|
// if the user is coming from a version pre-15, point them to the migration guide
|
|
113
151
|
const major = parseInt(previousVersion.split('.')[1]);
|
|
114
|
-
if (major <
|
|
115
|
-
console.log(`โ For a description of what's changed, visit this guide:
|
|
116
|
-
โ Don't forget to update your sourceGlob config value if you want to define documents in external files.`);
|
|
152
|
+
if (major < 16) {
|
|
153
|
+
console.log(`โ For a description of what's changed, visit this guide: http://docs-next-kohl.vercel.app/guides/release-notes`);
|
|
117
154
|
}
|
|
118
155
|
}
|
|
156
|
+
// print a line showing that the process is finished (wo document)
|
|
157
|
+
else if (artifactStats.total.length === 0) {
|
|
158
|
+
console.log(`๐ก No operation found. If that's unexpected, please check your config.`);
|
|
159
|
+
}
|
|
160
|
+
// print summaries of the changes
|
|
119
161
|
else if ([common_1.LogLevel.Summary, common_1.LogLevel.ShortSummary].includes(config.logLevel)) {
|
|
120
|
-
// count the number of unchanged
|
|
121
|
-
const unchanged = artifactStats.total.length -
|
|
122
|
-
artifactStats.changed.length -
|
|
123
|
-
artifactStats.new.length -
|
|
124
|
-
artifactStats.deleted.length;
|
|
125
162
|
// if we have any unchanged artifacts
|
|
126
|
-
if (unchanged > 0) {
|
|
163
|
+
if (unchanged > 0 && printMessage && !config.plugin) {
|
|
127
164
|
console.log(`๐ Unchanged: ${unchanged}`);
|
|
128
165
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
logFirst5(artifactStats.changed);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (artifactStats.new.length > 0) {
|
|
136
|
-
console.log(`โจ New: ${artifactStats.new.length}`);
|
|
137
|
-
if (config.logLevel === common_1.LogLevel.Summary) {
|
|
138
|
-
logFirst5(artifactStats.new);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (artifactStats.deleted.length > 0) {
|
|
142
|
-
console.log(`๐งน Deleted: ${artifactStats.deleted.length}`);
|
|
143
|
-
if (config.logLevel === common_1.LogLevel.Summary) {
|
|
144
|
-
logFirst5(artifactStats.deleted);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
166
|
+
logStyled('CREATED', artifactStats.new, config.logLevel, config.plugin);
|
|
167
|
+
logStyled('UPDATED', artifactStats.changed, config.logLevel, config.plugin);
|
|
168
|
+
logStyled('DELETED', artifactStats.deleted, config.logLevel, config.plugin);
|
|
147
169
|
}
|
|
170
|
+
// print the status of every file
|
|
148
171
|
else if (config.logLevel === common_1.LogLevel.Full) {
|
|
149
172
|
for (const artifact of artifactStats.total) {
|
|
150
173
|
// figure out the emoji to use
|
|
151
174
|
let emoji = '๐';
|
|
152
175
|
if (artifactStats.changed.includes(artifact)) {
|
|
153
|
-
emoji = 'โ๏ธ
|
|
176
|
+
emoji = 'โ๏ธ';
|
|
154
177
|
}
|
|
155
178
|
else if (artifactStats.new.includes(artifact)) {
|
|
156
179
|
emoji = 'โจ';
|
|
@@ -166,52 +189,79 @@ async function runPipeline(config, docs) {
|
|
|
166
189
|
exports.runPipeline = runPipeline;
|
|
167
190
|
async function collectDocuments(config) {
|
|
168
191
|
// the first step we have to do is grab a list of every file in the source tree
|
|
169
|
-
|
|
192
|
+
let sourceFiles = await (0, util_1.promisify)(glob_1.default)(config.include);
|
|
193
|
+
if (config.exclude) {
|
|
194
|
+
sourceFiles = sourceFiles.filter((filepath) => !(0, minimatch_1.default)(filepath, config.exclude));
|
|
195
|
+
}
|
|
170
196
|
// the list of documents we found
|
|
171
197
|
const documents = [];
|
|
172
198
|
// wait for every file to be processed
|
|
173
199
|
await Promise.all(sourceFiles.map(async (filepath) => {
|
|
174
200
|
// read the file
|
|
175
|
-
const contents = await
|
|
201
|
+
const contents = await (0, common_1.readFile)(filepath);
|
|
202
|
+
if (!contents) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
176
205
|
// if the file ends with .svelte, we need to look for graphql template tags
|
|
177
206
|
if (filepath.endsWith('.svelte')) {
|
|
178
|
-
documents.push(...(await
|
|
207
|
+
documents.push(...(await processSvelteFile(filepath, contents)));
|
|
179
208
|
}
|
|
180
|
-
|
|
181
|
-
else {
|
|
209
|
+
else if (filepath.endsWith('.graphql') || filepath.endsWith('.gql')) {
|
|
182
210
|
documents.push({
|
|
183
211
|
filepath,
|
|
184
212
|
document: contents,
|
|
185
213
|
});
|
|
186
214
|
}
|
|
215
|
+
// otherwise just treat the file as a javascript file
|
|
216
|
+
else {
|
|
217
|
+
documents.push(...(await processJSFile(config, filepath, contents)));
|
|
218
|
+
}
|
|
187
219
|
}));
|
|
188
220
|
return await Promise.all(documents.map(async ({ document, filepath }) => {
|
|
189
221
|
try {
|
|
190
222
|
return await processGraphQLDocument(config, filepath, document);
|
|
191
223
|
}
|
|
192
224
|
catch (e) {
|
|
193
|
-
throw {
|
|
194
|
-
...e,
|
|
195
|
-
filepath,
|
|
196
|
-
};
|
|
225
|
+
throw new common_1.HoudiniError({ filepath, message: e.message });
|
|
197
226
|
}
|
|
198
227
|
}));
|
|
199
228
|
}
|
|
200
|
-
async function
|
|
229
|
+
async function processJSFile(config, filepath, contents) {
|
|
230
|
+
const documents = [];
|
|
231
|
+
// parse the contents as js
|
|
232
|
+
let program;
|
|
233
|
+
try {
|
|
234
|
+
program = (await (0, common_1.parseJS)(contents)).script;
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
// add the filepath to the error message
|
|
238
|
+
throw new common_1.HoudiniError({ filepath, message: e.message });
|
|
239
|
+
}
|
|
240
|
+
// look for a graphql template tag
|
|
241
|
+
await (0, common_1.walkGraphQLTags)(config, program, {
|
|
242
|
+
tag(tag) {
|
|
243
|
+
documents.push({ document: tag.tagContent, filepath });
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
// we found every document in the file
|
|
247
|
+
return documents;
|
|
248
|
+
}
|
|
249
|
+
async function processSvelteFile(filepath, contents) {
|
|
201
250
|
const documents = [];
|
|
202
251
|
let parsedFile;
|
|
203
252
|
try {
|
|
204
|
-
parsedFile = await (0, common_1.
|
|
253
|
+
parsedFile = await (0, common_1.parseSvelte)(contents);
|
|
205
254
|
}
|
|
206
255
|
catch (e) {
|
|
207
256
|
const err = e;
|
|
208
257
|
// add the filepath to the error message
|
|
209
|
-
throw
|
|
258
|
+
throw new common_1.HoudiniError({
|
|
259
|
+
message: `Encountered error parsing ${filepath}`,
|
|
260
|
+
description: err.message,
|
|
261
|
+
});
|
|
210
262
|
}
|
|
211
263
|
// we need to look for multiple script tags to support sveltekit
|
|
212
|
-
const scripts = [parsedFile
|
|
213
|
-
.map((script) => (script ? script.content : null))
|
|
214
|
-
.filter(Boolean);
|
|
264
|
+
const scripts = [parsedFile];
|
|
215
265
|
await Promise.all(scripts.map(async (jsContent) => {
|
|
216
266
|
// @ts-ignore
|
|
217
267
|
// look for any template tag literals in the script body
|
|
@@ -240,13 +290,19 @@ async function processGraphQLDocument(config, filepath, document) {
|
|
|
240
290
|
const fragments = parsedDoc.definitions.filter(({ kind }) => kind === graphql.Kind.FRAGMENT_DEFINITION);
|
|
241
291
|
// if there is more than one operation, throw an error
|
|
242
292
|
if (operations.length > 1) {
|
|
243
|
-
throw {
|
|
293
|
+
throw new common_1.HoudiniError({
|
|
294
|
+
filepath,
|
|
295
|
+
message: 'Operation documents can only have one operation',
|
|
296
|
+
});
|
|
244
297
|
}
|
|
245
298
|
// we are looking at a fragment document
|
|
246
299
|
else {
|
|
247
300
|
// if there is more than one fragment, throw an error
|
|
248
301
|
if (fragments.length > 1) {
|
|
249
|
-
throw {
|
|
302
|
+
throw new common_1.HoudiniError({
|
|
303
|
+
filepath,
|
|
304
|
+
message: 'Fragment documents can only have one fragment',
|
|
305
|
+
});
|
|
250
306
|
}
|
|
251
307
|
}
|
|
252
308
|
// figure out the document kind
|
|
@@ -280,13 +336,51 @@ async function processGraphQLDocument(config, filepath, document) {
|
|
|
280
336
|
originalString: document,
|
|
281
337
|
};
|
|
282
338
|
}
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
339
|
+
function logStyled(kind, stat, logLevel, plugin) {
|
|
340
|
+
if (stat.length > 0) {
|
|
341
|
+
// Let's prepare the one liner in the plugin mode, of a bit more in other lol level.
|
|
342
|
+
const msg = [];
|
|
343
|
+
// in plugin mode, it will be very short, let's put a hat first.
|
|
344
|
+
if (plugin) {
|
|
345
|
+
msg.push(`๐ฉ `);
|
|
346
|
+
}
|
|
347
|
+
if (kind === 'CREATED') {
|
|
348
|
+
msg.push(`โจ `);
|
|
349
|
+
if (!plugin) {
|
|
350
|
+
msg.push(`New: ${stat.length}`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else if (kind === 'UPDATED') {
|
|
354
|
+
msg.push(`โ๏ธ `);
|
|
355
|
+
if (!plugin) {
|
|
356
|
+
msg.push(`Changed: ${stat.length}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else if (kind === 'DELETED') {
|
|
360
|
+
msg.push(`๐งน `);
|
|
361
|
+
if (!plugin) {
|
|
362
|
+
msg.push(`Deleted: ${stat.length}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
// let's do a summary for x elements
|
|
366
|
+
const nbToDisplay = 5;
|
|
367
|
+
// format for plugin
|
|
368
|
+
if (plugin) {
|
|
369
|
+
msg.push(`${stat.slice(0, nbToDisplay).join(', ')}`);
|
|
370
|
+
if (stat.length > 5) {
|
|
371
|
+
msg.push(`, ... ${stat.length - nbToDisplay} more`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
console.log(msg.join(''));
|
|
375
|
+
// Format for not plugin & Summary mode
|
|
376
|
+
if (!plugin && logLevel === common_1.LogLevel.Summary) {
|
|
377
|
+
for (const artifact of stat.slice(0, nbToDisplay)) {
|
|
378
|
+
console.log(` ${artifact}`);
|
|
379
|
+
}
|
|
380
|
+
// if there are more than 5 just tell them how many
|
|
381
|
+
if (stat.length > nbToDisplay) {
|
|
382
|
+
console.log(` ... ${stat.length - nbToDisplay} more`);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
291
385
|
}
|
|
292
386
|
}
|
|
@@ -23,7 +23,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
// external imports
|
|
27
26
|
const graphql = __importStar(require("graphql"));
|
|
28
27
|
// we need to generate a static key that we can use to index this field in the cache.
|
|
29
28
|
// this needs to be a unique hash driven by the field's attribute and arguments
|
|
@@ -34,9 +33,7 @@ function fieldKey(config, field) {
|
|
|
34
33
|
const attributeName = field.alias?.value || field.name.value;
|
|
35
34
|
// field might not have a location so print and re-parse before we look at serialized values
|
|
36
35
|
const printed = graphql.print(field);
|
|
37
|
-
const secondParse = graphql.parse(`{${printed}}`)
|
|
38
|
-
.definitions[0].selectionSet
|
|
39
|
-
.selections[0];
|
|
36
|
+
const secondParse = graphql.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
40
37
|
// if the field is paginated, we need to strip away any args
|
|
41
38
|
const paginated = !!field.directives?.find((directive) => directive.name.value === config.paginateDirective);
|
|
42
39
|
const paginationArgs = ['first', 'after', 'last', 'before', 'limit', 'offset'];
|