@powerhousedao/builder-tools 6.0.0-dev.17 → 6.0.0-dev.171
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/dist/index.d.mts +174 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +472 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +17 -118
- package/dist/browser.d.ts +0 -2
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -2
- package/dist/browser.js.map +0 -1
- package/dist/connect-build/build.d.ts +0 -6
- package/dist/connect-build/build.d.ts.map +0 -1
- package/dist/connect-build/build.js +0 -54
- package/dist/connect-build/build.js.map +0 -1
- package/dist/connect-build/constants.d.ts +0 -11
- package/dist/connect-build/constants.d.ts.map +0 -1
- package/dist/connect-build/constants.js +0 -11
- package/dist/connect-build/constants.js.map +0 -1
- package/dist/connect-build/helpers.d.ts +0 -37
- package/dist/connect-build/helpers.d.ts.map +0 -1
- package/dist/connect-build/helpers.js +0 -111
- package/dist/connect-build/helpers.js.map +0 -1
- package/dist/connect-build/index.d.ts +0 -5
- package/dist/connect-build/index.d.ts.map +0 -1
- package/dist/connect-build/index.js +0 -4
- package/dist/connect-build/index.js.map +0 -1
- package/dist/connect-build/preview.d.ts +0 -3
- package/dist/connect-build/preview.d.ts.map +0 -1
- package/dist/connect-build/preview.js +0 -19
- package/dist/connect-build/preview.js.map +0 -1
- package/dist/connect-build/types.d.ts +0 -27
- package/dist/connect-build/types.d.ts.map +0 -1
- package/dist/connect-build/types.js +0 -2
- package/dist/connect-build/types.js.map +0 -1
- package/dist/connect-studio/index.d.ts +0 -3
- package/dist/connect-studio/index.d.ts.map +0 -1
- package/dist/connect-studio/index.js +0 -2
- package/dist/connect-studio/index.js.map +0 -1
- package/dist/connect-studio/server.d.ts +0 -3
- package/dist/connect-studio/server.d.ts.map +0 -1
- package/dist/connect-studio/server.js +0 -234
- package/dist/connect-studio/server.js.map +0 -1
- package/dist/connect-studio/studio.d.ts +0 -3
- package/dist/connect-studio/studio.d.ts.map +0 -1
- package/dist/connect-studio/studio.js +0 -66
- package/dist/connect-studio/studio.js.map +0 -1
- package/dist/connect-studio/types.d.ts +0 -28
- package/dist/connect-studio/types.d.ts.map +0 -1
- package/dist/connect-studio/types.js +0 -2
- package/dist/connect-studio/types.js.map +0 -1
- package/dist/connect-utils/build.d.ts +0 -3
- package/dist/connect-utils/build.d.ts.map +0 -1
- package/dist/connect-utils/build.js +0 -21
- package/dist/connect-utils/build.js.map +0 -1
- package/dist/connect-utils/constants.d.ts +0 -5
- package/dist/connect-utils/constants.d.ts.map +0 -1
- package/dist/connect-utils/constants.js +0 -5
- package/dist/connect-utils/constants.js.map +0 -1
- package/dist/connect-utils/env-config.d.ts +0 -844
- package/dist/connect-utils/env-config.d.ts.map +0 -1
- package/dist/connect-utils/env-config.js +0 -518
- package/dist/connect-utils/env-config.js.map +0 -1
- package/dist/connect-utils/helpers.d.ts +0 -48
- package/dist/connect-utils/helpers.d.ts.map +0 -1
- package/dist/connect-utils/helpers.js +0 -265
- package/dist/connect-utils/helpers.js.map +0 -1
- package/dist/connect-utils/index.d.ts +0 -16
- package/dist/connect-utils/index.d.ts.map +0 -1
- package/dist/connect-utils/index.js +0 -16
- package/dist/connect-utils/index.js.map +0 -1
- package/dist/connect-utils/preview.d.ts +0 -3
- package/dist/connect-utils/preview.d.ts.map +0 -1
- package/dist/connect-utils/preview.js +0 -33
- package/dist/connect-utils/preview.js.map +0 -1
- package/dist/connect-utils/studio.d.ts +0 -7
- package/dist/connect-utils/studio.d.ts.map +0 -1
- package/dist/connect-utils/studio.js +0 -30
- package/dist/connect-utils/studio.js.map +0 -1
- package/dist/connect-utils/types.d.ts +0 -38
- package/dist/connect-utils/types.d.ts.map +0 -1
- package/dist/connect-utils/types.js +0 -2
- package/dist/connect-utils/types.js.map +0 -1
- package/dist/connect-utils/vite-config.d.ts +0 -61
- package/dist/connect-utils/vite-config.d.ts.map +0 -1
- package/dist/connect-utils/vite-config.js +0 -267
- package/dist/connect-utils/vite-config.js.map +0 -1
- package/dist/connect-utils/vite-plugins/base.d.ts +0 -10
- package/dist/connect-utils/vite-plugins/base.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/base.js +0 -130
- package/dist/connect-utils/vite-plugins/base.js.map +0 -1
- package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts +0 -3
- package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/document-models-hmr.js +0 -62
- package/dist/connect-utils/vite-plugins/document-models-hmr.js.map +0 -1
- package/dist/connect-utils/vite-plugins/editors-hmr.d.ts +0 -3
- package/dist/connect-utils/vite-plugins/editors-hmr.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/editors-hmr.js +0 -61
- package/dist/connect-utils/vite-plugins/editors-hmr.js.map +0 -1
- package/dist/connect-utils/vite-plugins/external-packages.d.ts +0 -3
- package/dist/connect-utils/vite-plugins/external-packages.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/external-packages.js +0 -127
- package/dist/connect-utils/vite-plugins/external-packages.js.map +0 -1
- package/dist/connect-utils/vite-plugins/importmap.d.ts +0 -23
- package/dist/connect-utils/vite-plugins/importmap.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/importmap.js +0 -243
- package/dist/connect-utils/vite-plugins/importmap.js.map +0 -1
- package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts +0 -2
- package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/ph-external-packages.js +0 -88
- package/dist/connect-utils/vite-plugins/ph-external-packages.js.map +0 -1
- package/dist/connect-utils/vite-plugins/studio.d.ts +0 -3
- package/dist/connect-utils/vite-plugins/studio.d.ts.map +0 -1
- package/dist/connect-utils/vite-plugins/studio.js +0 -33
- package/dist/connect-utils/vite-plugins/studio.js.map +0 -1
- package/dist/document-model-editor/components/button.d.ts +0 -2
- package/dist/document-model-editor/components/button.d.ts.map +0 -1
- package/dist/document-model-editor/components/button.js +0 -8
- package/dist/document-model-editor/components/button.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.d.ts +0 -3
- package/dist/document-model-editor/components/code-editors/constants.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.js +0 -38
- package/dist/document-model-editor/components/code-editors/constants.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.d.ts +0 -4
- package/dist/document-model-editor/components/code-editors/factories.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.js +0 -47
- package/dist/document-model-editor/components/code-editors/factories.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts +0 -10
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.js +0 -73
- package/dist/document-model-editor/components/code-editors/graphql-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.d.ts +0 -23
- package/dist/document-model-editor/components/code-editors/hooks.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.js +0 -59
- package/dist/document-model-editor/components/code-editors/hooks.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts +0 -8
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.js +0 -47
- package/dist/document-model-editor/components/code-editors/json-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.d.ts +0 -6
- package/dist/document-model-editor/components/code-editors/linting.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.js +0 -59
- package/dist/document-model-editor/components/code-editors/linting.js.map +0 -1
- package/dist/document-model-editor/components/divider.d.ts +0 -8
- package/dist/document-model-editor/components/divider.d.ts.map +0 -1
- package/dist/document-model-editor/components/divider.js +0 -22
- package/dist/document-model-editor/components/divider.js.map +0 -1
- package/dist/document-model-editor/components/errors.d.ts +0 -6
- package/dist/document-model-editor/components/errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/errors.js +0 -5
- package/dist/document-model-editor/components/errors.js.map +0 -1
- package/dist/document-model-editor/components/form.d.ts +0 -12
- package/dist/document-model-editor/components/form.d.ts.map +0 -1
- package/dist/document-model-editor/components/form.js +0 -43
- package/dist/document-model-editor/components/form.js.map +0 -1
- package/dist/document-model-editor/components/input.d.ts +0 -6
- package/dist/document-model-editor/components/input.d.ts.map +0 -1
- package/dist/document-model-editor/components/input.js +0 -9
- package/dist/document-model-editor/components/input.js.map +0 -1
- package/dist/document-model-editor/components/label.d.ts +0 -6
- package/dist/document-model-editor/components/label.d.ts.map +0 -1
- package/dist/document-model-editor/components/label.js +0 -10
- package/dist/document-model-editor/components/label.js.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.d.ts +0 -31
- package/dist/document-model-editor/components/model-metadata-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.js +0 -70
- package/dist/document-model-editor/components/model-metadata-form.js.map +0 -1
- package/dist/document-model-editor/components/module-form.d.ts +0 -10
- package/dist/document-model-editor/components/module-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/module-form.js +0 -22
- package/dist/document-model-editor/components/module-form.js.map +0 -1
- package/dist/document-model-editor/components/module.d.ts +0 -22
- package/dist/document-model-editor/components/module.d.ts.map +0 -1
- package/dist/document-model-editor/components/module.js +0 -10
- package/dist/document-model-editor/components/module.js.map +0 -1
- package/dist/document-model-editor/components/modules.d.ts +0 -20
- package/dist/document-model-editor/components/modules.d.ts.map +0 -1
- package/dist/document-model-editor/components/modules.js +0 -17
- package/dist/document-model-editor/components/modules.js.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.d.ts +0 -9
- package/dist/document-model-editor/components/operation-description-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.js +0 -13
- package/dist/document-model-editor/components/operation-description-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-error-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.js +0 -40
- package/dist/document-model-editor/components/operation-error-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-errors.d.ts +0 -10
- package/dist/document-model-editor/components/operation-errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-errors.js +0 -17
- package/dist/document-model-editor/components/operation-errors.js.map +0 -1
- package/dist/document-model-editor/components/operation-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-form.js +0 -37
- package/dist/document-model-editor/components/operation-form.js.map +0 -1
- package/dist/document-model-editor/components/operation.d.ts +0 -23
- package/dist/document-model-editor/components/operation.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation.js +0 -25
- package/dist/document-model-editor/components/operation.js.map +0 -1
- package/dist/document-model-editor/components/operations.d.ts +0 -18
- package/dist/document-model-editor/components/operations.d.ts.map +0 -1
- package/dist/document-model-editor/components/operations.js +0 -20
- package/dist/document-model-editor/components/operations.js.map +0 -1
- package/dist/document-model-editor/components/state-error.d.ts +0 -5
- package/dist/document-model-editor/components/state-error.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-error.js +0 -21
- package/dist/document-model-editor/components/state-error.js.map +0 -1
- package/dist/document-model-editor/components/state-schemas.d.ts +0 -15
- package/dist/document-model-editor/components/state-schemas.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-schemas.js +0 -81
- package/dist/document-model-editor/components/state-schemas.js.map +0 -1
- package/dist/document-model-editor/components/tabs.d.ts +0 -8
- package/dist/document-model-editor/components/tabs.d.ts.map +0 -1
- package/dist/document-model-editor/components/tabs.js +0 -13
- package/dist/document-model-editor/components/tabs.js.map +0 -1
- package/dist/document-model-editor/components/text-area.d.ts +0 -9
- package/dist/document-model-editor/components/text-area.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-area.js +0 -27
- package/dist/document-model-editor/components/text-area.js.map +0 -1
- package/dist/document-model-editor/components/text-field.d.ts +0 -21
- package/dist/document-model-editor/components/text-field.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-field.js +0 -80
- package/dist/document-model-editor/components/text-field.js.map +0 -1
- package/dist/document-model-editor/config.d.ts +0 -3
- package/dist/document-model-editor/config.d.ts.map +0 -1
- package/dist/document-model-editor/config.js +0 -4
- package/dist/document-model-editor/config.js.map +0 -1
- package/dist/document-model-editor/constants/documents.d.ts +0 -13
- package/dist/document-model-editor/constants/documents.d.ts.map +0 -1
- package/dist/document-model-editor/constants/documents.js +0 -18
- package/dist/document-model-editor/constants/documents.js.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.d.ts +0 -9
- package/dist/document-model-editor/constants/graphql-kinds.d.ts.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.js +0 -13
- package/dist/document-model-editor/constants/graphql-kinds.js.map +0 -1
- package/dist/document-model-editor/context/form-context.d.ts +0 -11
- package/dist/document-model-editor/context/form-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/form-context.js +0 -4
- package/dist/document-model-editor/context/form-context.js.map +0 -1
- package/dist/document-model-editor/context/schema-context.d.ts +0 -18
- package/dist/document-model-editor/context/schema-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/schema-context.js +0 -129
- package/dist/document-model-editor/context/schema-context.js.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.d.ts +0 -8
- package/dist/document-model-editor/document-model-editor.stories.d.ts.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.js +0 -267
- package/dist/document-model-editor/document-model-editor.stories.js.map +0 -1
- package/dist/document-model-editor/editor.d.ts +0 -2
- package/dist/document-model-editor/editor.d.ts.map +0 -1
- package/dist/document-model-editor/editor.js +0 -217
- package/dist/document-model-editor/editor.js.map +0 -1
- package/dist/document-model-editor/hooks/index.d.ts +0 -3
- package/dist/document-model-editor/hooks/index.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/index.js +0 -3
- package/dist/document-model-editor/hooks/index.js.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts +0 -5
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js +0 -8
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.d.ts +0 -13
- package/dist/document-model-editor/hooks/useFormField.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.js +0 -22
- package/dist/document-model-editor/hooks/useFormField.js.map +0 -1
- package/dist/document-model-editor/index.d.ts +0 -2
- package/dist/document-model-editor/index.d.ts.map +0 -1
- package/dist/document-model-editor/index.js +0 -2
- package/dist/document-model-editor/index.js.map +0 -1
- package/dist/document-model-editor/module.d.ts +0 -3
- package/dist/document-model-editor/module.d.ts.map +0 -1
- package/dist/document-model-editor/module.js +0 -10
- package/dist/document-model-editor/module.js.map +0 -1
- package/dist/document-model-editor/schemas/inputs.d.ts +0 -25
- package/dist/document-model-editor/schemas/inputs.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/inputs.js +0 -71
- package/dist/document-model-editor/schemas/inputs.js.map +0 -1
- package/dist/document-model-editor/schemas/utils.d.ts +0 -3
- package/dist/document-model-editor/schemas/utils.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/utils.js +0 -3
- package/dist/document-model-editor/schemas/utils.js.map +0 -1
- package/dist/document-model-editor/types/documents.d.ts +0 -26
- package/dist/document-model-editor/types/documents.d.ts.map +0 -1
- package/dist/document-model-editor/types/documents.js +0 -2
- package/dist/document-model-editor/types/documents.js.map +0 -1
- package/dist/document-model-editor/types.d.ts +0 -2
- package/dist/document-model-editor/types.d.ts.map +0 -1
- package/dist/document-model-editor/types.js +0 -2
- package/dist/document-model-editor/types.js.map +0 -1
- package/dist/document-model-editor/utils/helpers.d.ts +0 -112
- package/dist/document-model-editor/utils/helpers.d.ts.map +0 -1
- package/dist/document-model-editor/utils/helpers.js +0 -920
- package/dist/document-model-editor/utils/helpers.js.map +0 -1
- package/dist/document-model-editor/utils/linting.d.ts +0 -7
- package/dist/document-model-editor/utils/linting.d.ts.map +0 -1
- package/dist/document-model-editor/utils/linting.js +0 -49
- package/dist/document-model-editor/utils/linting.js.map +0 -1
- package/dist/document-model-editor/utils/style.d.ts +0 -3
- package/dist/document-model-editor/utils/style.d.ts.map +0 -1
- package/dist/document-model-editor/utils/style.js +0 -6
- package/dist/document-model-editor/utils/style.js.map +0 -1
- package/dist/editor-utils/components/documentEditor.d.ts +0 -7
- package/dist/editor-utils/components/documentEditor.d.ts.map +0 -1
- package/dist/editor-utils/components/documentEditor.js +0 -6
- package/dist/editor-utils/components/documentEditor.js.map +0 -1
- package/dist/editor-utils/components/editorToolbar.d.ts +0 -11
- package/dist/editor-utils/components/editorToolbar.d.ts.map +0 -1
- package/dist/editor-utils/components/editorToolbar.js +0 -6
- package/dist/editor-utils/components/editorToolbar.js.map +0 -1
- package/dist/editor-utils/components/editorWorksheet.d.ts +0 -7
- package/dist/editor-utils/components/editorWorksheet.d.ts.map +0 -1
- package/dist/editor-utils/components/editorWorksheet.js +0 -5
- package/dist/editor-utils/components/editorWorksheet.js.map +0 -1
- package/dist/editor-utils/components/index.d.ts +0 -9
- package/dist/editor-utils/components/index.d.ts.map +0 -1
- package/dist/editor-utils/components/index.js +0 -10
- package/dist/editor-utils/components/index.js.map +0 -1
- package/dist/editor-utils/components/styles.d.ts +0 -40
- package/dist/editor-utils/components/styles.d.ts.map +0 -1
- package/dist/editor-utils/components/styles.js +0 -79
- package/dist/editor-utils/components/styles.js.map +0 -1
- package/dist/editor-utils/components/stylesVariant.d.ts +0 -40
- package/dist/editor-utils/components/stylesVariant.d.ts.map +0 -1
- package/dist/editor-utils/components/stylesVariant.js +0 -89
- package/dist/editor-utils/components/stylesVariant.js.map +0 -1
- package/dist/editor-utils/components/textInput.d.ts +0 -20
- package/dist/editor-utils/components/textInput.d.ts.map +0 -1
- package/dist/editor-utils/components/textInput.js +0 -84
- package/dist/editor-utils/components/textInput.js.map +0 -1
- package/dist/editor-utils/components/textInputVariant.d.ts +0 -21
- package/dist/editor-utils/components/textInputVariant.d.ts.map +0 -1
- package/dist/editor-utils/components/textInputVariant.js +0 -93
- package/dist/editor-utils/components/textInputVariant.js.map +0 -1
- package/dist/editor-utils/components/toolbarButton.d.ts +0 -7
- package/dist/editor-utils/components/toolbarButton.d.ts.map +0 -1
- package/dist/editor-utils/components/toolbarButton.js +0 -9
- package/dist/editor-utils/components/toolbarButton.js.map +0 -1
- package/dist/editor-utils/hooks/index.d.ts +0 -2
- package/dist/editor-utils/hooks/index.d.ts.map +0 -1
- package/dist/editor-utils/hooks/index.js +0 -2
- package/dist/editor-utils/hooks/index.js.map +0 -1
- package/dist/editor-utils/hooks/useEnsInfo.d.ts +0 -15
- package/dist/editor-utils/hooks/useEnsInfo.d.ts.map +0 -1
- package/dist/editor-utils/hooks/useEnsInfo.js +0 -64
- package/dist/editor-utils/hooks/useEnsInfo.js.map +0 -1
- package/dist/editor-utils/index.d.ts +0 -5
- package/dist/editor-utils/index.d.ts.map +0 -1
- package/dist/editor-utils/index.js +0 -5
- package/dist/editor-utils/index.js.map +0 -1
- package/dist/editor-utils/reducer.d.ts +0 -3
- package/dist/editor-utils/reducer.d.ts.map +0 -1
- package/dist/editor-utils/reducer.js +0 -25
- package/dist/editor-utils/reducer.js.map +0 -1
- package/dist/editor-utils/storybook.d.ts +0 -32
- package/dist/editor-utils/storybook.d.ts.map +0 -1
- package/dist/editor-utils/storybook.js +0 -104
- package/dist/editor-utils/storybook.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/style.css +0 -890
- package/dist/test/helpers.test.d.ts +0 -2
- package/dist/test/helpers.test.d.ts.map +0 -1
- package/dist/test/helpers.test.js +0 -805
- package/dist/test/helpers.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -2
- package/dist/test/index.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { CommonServerOptions, HtmlTagDescriptor, InlineConfig, Plugin } from "vite";
|
|
2
|
+
import { PowerhouseConfig } from "@powerhousedao/config";
|
|
3
|
+
|
|
4
|
+
//#region connect-utils/constants.d.ts
|
|
5
|
+
declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
|
|
6
|
+
declare const IMPORT_SCRIPT_FILE = "external-packages.js";
|
|
7
|
+
declare const LOCAL_PACKAGE_ID = "ph:local-package";
|
|
8
|
+
declare const PH_DIR_NAME = ".ph";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region connect-utils/types.d.ts
|
|
11
|
+
type IConnectOptions = {
|
|
12
|
+
mode: string;
|
|
13
|
+
dirname: string;
|
|
14
|
+
envDir?: string;
|
|
15
|
+
powerhouseConfig?: PowerhouseConfig;
|
|
16
|
+
watchTimeout?: number;
|
|
17
|
+
};
|
|
18
|
+
type ConnectCommonOptions = {
|
|
19
|
+
base?: string;
|
|
20
|
+
mode?: string;
|
|
21
|
+
configFile?: string;
|
|
22
|
+
projectRoot?: string;
|
|
23
|
+
viteConfigFile?: string;
|
|
24
|
+
disableLocalPackage?: boolean;
|
|
25
|
+
defaultDrivesUrl?: string[];
|
|
26
|
+
drivesPreserveStrategy?: "preserve-all" | "preserve-by-url-and-detach";
|
|
27
|
+
};
|
|
28
|
+
type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
|
|
29
|
+
force?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type ConnectStudioOptions = ConnectCommonOptions & {
|
|
32
|
+
devServerOptions?: ViteDevOptions;
|
|
33
|
+
printUrls?: boolean;
|
|
34
|
+
bindCLIShortcuts?: boolean;
|
|
35
|
+
};
|
|
36
|
+
type ConnectBuildOptions = ConnectCommonOptions & {
|
|
37
|
+
outDir?: string;
|
|
38
|
+
};
|
|
39
|
+
type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
|
|
40
|
+
outDir?: string;
|
|
41
|
+
printUrls?: boolean;
|
|
42
|
+
bindCLIShortcuts?: boolean;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region connect-utils/helpers.d.ts
|
|
46
|
+
declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
|
|
47
|
+
declare function commonConnectOptionsToEnv(options: ConnectCommonOptions): void;
|
|
48
|
+
declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
|
|
49
|
+
declare function resolvePackage(packageName: string, root?: string): string;
|
|
50
|
+
declare function resolveConnectPackageJson(root?: string): JSON | null;
|
|
51
|
+
/**
|
|
52
|
+
* Finds the dist dir of Connect on the local machine
|
|
53
|
+
*/
|
|
54
|
+
declare function resolveConnectBundle(root?: string): string;
|
|
55
|
+
declare function resolveConnectPublicDir(root?: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Copies the Connect dist dir to the target path
|
|
58
|
+
*/
|
|
59
|
+
declare function copyConnect(sourcePath: string, targetPath: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Backs up the index.html file
|
|
62
|
+
*
|
|
63
|
+
* Needed when running the Connect Studio dev server on Windows
|
|
64
|
+
*/
|
|
65
|
+
declare function backupIndexHtml(appPath: string, restore?: boolean): void;
|
|
66
|
+
declare function removeBase64EnvValues(appPath: string): void;
|
|
67
|
+
declare function readJsonFile(filePath: string): PowerhouseConfig | null;
|
|
68
|
+
/**
|
|
69
|
+
* Takes a list of Powerhouse project packages and optionally local Powerhouse packages and outputs a js file which exports those packages for use in Connect Studio.
|
|
70
|
+
*/
|
|
71
|
+
declare function makeImportScriptFromPackages(args: {
|
|
72
|
+
packages: string[];
|
|
73
|
+
importStyles?: boolean;
|
|
74
|
+
localJsPath?: string;
|
|
75
|
+
localCssPath?: string;
|
|
76
|
+
}): string;
|
|
77
|
+
declare function ensureNodeVersion(minVersion?: string): void;
|
|
78
|
+
declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
|
|
79
|
+
/**
|
|
80
|
+
* Appends the contents to the <head> tag of the index.html file
|
|
81
|
+
*/
|
|
82
|
+
declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Prepends the contents to the <head> tag of the index.html file
|
|
85
|
+
*/
|
|
86
|
+
declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
87
|
+
declare function runTsc(outDir: string): void;
|
|
88
|
+
declare function stripVersionFromPackage(packageName: string): string;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region connect-utils/vite-config.d.ts
|
|
91
|
+
declare function getConnectHtmlTags(options?: {
|
|
92
|
+
registryUrl?: string | null;
|
|
93
|
+
injectTo?: HtmlTagDescriptor["injectTo"];
|
|
94
|
+
}): [{
|
|
95
|
+
readonly tag: "meta";
|
|
96
|
+
readonly attrs: {
|
|
97
|
+
readonly "http-equiv": "Content-Security-Policy";
|
|
98
|
+
readonly content: `script-src 'self' 'unsafe-inline' 'unsafe-eval' https://esm.sh${string}; object-src 'none'; base-uri 'self';`;
|
|
99
|
+
};
|
|
100
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
101
|
+
}, {
|
|
102
|
+
readonly tag: "meta";
|
|
103
|
+
readonly attrs: {
|
|
104
|
+
readonly property: "og:title";
|
|
105
|
+
readonly content: "Connect";
|
|
106
|
+
};
|
|
107
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
108
|
+
}, {
|
|
109
|
+
readonly tag: "meta";
|
|
110
|
+
readonly attrs: {
|
|
111
|
+
readonly property: "og:type";
|
|
112
|
+
readonly content: "website";
|
|
113
|
+
};
|
|
114
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
115
|
+
}, {
|
|
116
|
+
readonly tag: "meta";
|
|
117
|
+
readonly attrs: {
|
|
118
|
+
readonly property: "og:url";
|
|
119
|
+
readonly content: "https://apps.powerhouse.io/powerhouse/connect/";
|
|
120
|
+
};
|
|
121
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
122
|
+
}, {
|
|
123
|
+
readonly tag: "meta";
|
|
124
|
+
readonly attrs: {
|
|
125
|
+
readonly property: "og:description";
|
|
126
|
+
readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
|
|
127
|
+
};
|
|
128
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
129
|
+
}, {
|
|
130
|
+
readonly tag: "meta";
|
|
131
|
+
readonly attrs: {
|
|
132
|
+
readonly property: "og:image";
|
|
133
|
+
readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
|
|
134
|
+
};
|
|
135
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
136
|
+
}, {
|
|
137
|
+
readonly tag: "meta";
|
|
138
|
+
readonly attrs: {
|
|
139
|
+
readonly name: "twitter:card";
|
|
140
|
+
readonly content: "summary_large_image";
|
|
141
|
+
};
|
|
142
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
143
|
+
}, {
|
|
144
|
+
readonly tag: "meta";
|
|
145
|
+
readonly attrs: {
|
|
146
|
+
readonly name: "twitter:image";
|
|
147
|
+
readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
|
|
148
|
+
};
|
|
149
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
150
|
+
}, {
|
|
151
|
+
readonly tag: "meta";
|
|
152
|
+
readonly attrs: {
|
|
153
|
+
readonly name: "twitter:title";
|
|
154
|
+
readonly content: "Connect";
|
|
155
|
+
};
|
|
156
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
157
|
+
}, {
|
|
158
|
+
readonly tag: "meta";
|
|
159
|
+
readonly attrs: {
|
|
160
|
+
readonly name: "twitter:description";
|
|
161
|
+
readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
|
|
162
|
+
};
|
|
163
|
+
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
164
|
+
}];
|
|
165
|
+
declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region connect-utils/vite-plugins/ph-packages.d.ts
|
|
168
|
+
type PhPackagesPluginOptions = {
|
|
169
|
+
packages: string[];
|
|
170
|
+
};
|
|
171
|
+
declare function phPackagesPlugin(options: PhPackagesPluginOptions): Plugin;
|
|
172
|
+
//#endregion
|
|
173
|
+
export { ConnectBuildOptions, ConnectCommonOptions, ConnectPreviewOptions, ConnectStudioOptions, DEFAULT_CONNECT_OUTDIR, EXTERNAL_PACKAGES_IMPORT, IConnectOptions, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, PH_DIR_NAME, PhPackagesPluginOptions, ViteDevOptions, appendToHtmlHead, backupIndexHtml, commonConnectOptionsToEnv, copyConnect, ensureNodeVersion, getConnectBaseViteConfig, getConnectHtmlTags, makeImportScriptFromPackages, phPackagesPlugin, prependToHtmlHead, readJsonFile, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolvePackage, resolveViteConfigPath, runShellScriptPlugin, runTsc, stripVersionFromPackage };
|
|
174
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../connect-utils/constants.ts","../connect-utils/types.ts","../connect-utils/helpers.ts","../connect-utils/vite-config.ts","../connect-utils/vite-plugins/ph-packages.ts"],"mappings":";;;;cAAa,wBAAA;AAAA,cACA,kBAAA;AAAA,cACA,gBAAA;AAAA,cACA,WAAA;;;KCAD,eAAA;EACV,IAAA;EACA,OAAA;EACA,MAAA;EACA,gBAAA,GAAmB,gBAAA;EACnB,YAAA;AAAA;AAAA,KAGU,oBAAA;EAEV,IAAA;EAEA,IAAA;EAEA,UAAA;EAEA,WAAA;EAEA,cAAA;EAEA,mBAAA;EAEA,gBAAA;EAEA,sBAAA;AAAA;AAAA,KAGU,cAAA,GAAiB,IAAA,CAC3B,mBAAA;EAEI,KAAA;AAAA;AAAA,KAEM,oBAAA,GAAuB,oBAAA;EACjC,gBAAA,GAAmB,cAAA;EACnB,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,oBAAA;EAEhC,MAAA;AAAA;AAAA,KAGU,qBAAA,GAAwB,oBAAA,GAClC,IAAA,CAAK,cAAA;EAEH,MAAA;EACA,SAAA;EACA,gBAAA;AAAA;;;cCvCS,sBAAA;AAAA,iBAEG,yBAAA,CAA0B,OAAA,EAAS,oBAAA;AAAA,iBAqCnC,qBAAA,CACd,OAAA,EAAS,IAAA,CAAK,oBAAA;AAAA,iBAMA,cAAA,CAAe,WAAA,UAAqB,IAAA;AAAA,iBAMpC,yBAAA,CAA0B,IAAA,YAAoB,IAAA;;AF/D9D;;iBEgFgB,oBAAA,CAAqB,IAAA;AAAA,iBASrB,uBAAA,CAAwB,IAAA;;AFxFxC;;iBEmGgB,WAAA,CAAY,UAAA,UAAoB,UAAA;;;AFlGhD;;;iBEmHgB,eAAA,CAAgB,OAAA,UAAiB,OAAA;AAAA,iBAWjC,qBAAA,CAAsB,OAAA;AAAA,iBAmCtB,YAAA,CAAa,QAAA,WAAmB,gBAAA;;;ADjKhD;iBC+KgB,4BAAA,CAA6B,IAAA;EAC3C,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;AAAA;AAAA,iBAsDc,iBAAA,CAAkB,UAAA;AAAA,iBAclB,oBAAA,CACd,UAAA,UACA,WAAA,WACC,MAAA;;;;iBAwCmB,gBAAA,CAAiB,UAAA,UAAoB,QAAA,WAAgB,OAAA;;;;iBAYrD,iBAAA,CAAkB,UAAA,UAAoB,QAAA,WAAgB,OAAA;AAAA,iBAS5D,MAAA,CAAO,MAAA;AAAA,iBAMP,uBAAA,CAAwB,WAAA;;;iBC5SxB,kBAAA,CACd,OAAA;EACE,WAAA;EACA,QAAA,GAAW,iBAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2HC,wBAAA,CAAyB,OAAA,EAAS,eAAA,GAAe,YAAA;;;KChJrD,uBAAA;EACV,QAAA;AAAA;AAAA,iBAGc,gBAAA,CAAiB,OAAA,EAAS,uBAAA,GAA0B,MAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { exec, execSync } from "node:child_process";
|
|
3
|
+
import fs, { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
5
|
+
import path, { join, resolve } from "node:path";
|
|
6
|
+
import { cwd } from "node:process";
|
|
7
|
+
import { loadConnectEnv, setConnectEnv } from "@powerhousedao/shared/connect";
|
|
8
|
+
import { getConfig } from "@powerhousedao/config/node";
|
|
9
|
+
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
|
10
|
+
import tailwind from "@tailwindcss/vite";
|
|
11
|
+
import react from "@vitejs/plugin-react";
|
|
12
|
+
import { createLogger, esmExternalRequirePlugin, loadEnv } from "vite";
|
|
13
|
+
import { createHtmlPlugin } from "vite-plugin-html";
|
|
14
|
+
//#region connect-utils/constants.ts
|
|
15
|
+
const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
|
|
16
|
+
const IMPORT_SCRIPT_FILE = "external-packages.js";
|
|
17
|
+
const LOCAL_PACKAGE_ID = "ph:local-package";
|
|
18
|
+
const PH_DIR_NAME = ".ph";
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region connect-utils/helpers.ts
|
|
21
|
+
const DEFAULT_CONNECT_OUTDIR = ".ph/connect-build/dist/";
|
|
22
|
+
function commonConnectOptionsToEnv(options) {
|
|
23
|
+
const { base, configFile, defaultDrivesUrl, drivesPreserveStrategy, disableLocalPackage } = options;
|
|
24
|
+
if (base) setConnectEnv({ PH_CONNECT_BASE_PATH: base });
|
|
25
|
+
if (configFile) setConnectEnv({ PH_CONFIG_PATH: configFile });
|
|
26
|
+
if (defaultDrivesUrl) setConnectEnv({ PH_CONNECT_DEFAULT_DRIVES_URL: defaultDrivesUrl.join(",") });
|
|
27
|
+
if (drivesPreserveStrategy) setConnectEnv({ PH_CONNECT_DRIVES_PRESERVE_STRATEGY: drivesPreserveStrategy });
|
|
28
|
+
if (disableLocalPackage) setConnectEnv({ PH_DISABLE_LOCAL_PACKAGE: true });
|
|
29
|
+
}
|
|
30
|
+
function resolveViteConfigPath(options) {
|
|
31
|
+
const { projectRoot = cwd(), viteConfigFile } = options;
|
|
32
|
+
return viteConfigFile || join(projectRoot, "vite.config.ts");
|
|
33
|
+
}
|
|
34
|
+
function resolvePackage(packageName, root = process.cwd()) {
|
|
35
|
+
return createRequire(root).resolve(packageName, { paths: [root] });
|
|
36
|
+
}
|
|
37
|
+
function resolveConnectPackageJson(root = process.cwd()) {
|
|
38
|
+
try {
|
|
39
|
+
const connectPackageJsonPath = resolvePackage("@powerhousedao/connect/package.json", root);
|
|
40
|
+
const fileContents = fs.readFileSync(connectPackageJsonPath, "utf-8");
|
|
41
|
+
return JSON.parse(fileContents);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(`Error reading Connect package.json:`, error);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Finds the dist dir of Connect on the local machine
|
|
49
|
+
*/
|
|
50
|
+
function resolveConnectBundle(root = process.cwd()) {
|
|
51
|
+
const connectIndexPath = resolvePackage("@powerhousedao/connect", root);
|
|
52
|
+
return join(connectIndexPath.substring(0, connectIndexPath.indexOf("connect") + 7), "dist/");
|
|
53
|
+
}
|
|
54
|
+
function resolveConnectPublicDir(root = process.cwd()) {
|
|
55
|
+
const connectIconPath = resolvePackage("@powerhousedao/connect/public/icon.ico", root);
|
|
56
|
+
return path.join(connectIconPath, "../");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Copies the Connect dist dir to the target path
|
|
60
|
+
*/
|
|
61
|
+
function copyConnect(sourcePath, targetPath) {
|
|
62
|
+
try {
|
|
63
|
+
fs.rmSync(targetPath, {
|
|
64
|
+
recursive: true,
|
|
65
|
+
force: true
|
|
66
|
+
});
|
|
67
|
+
fs.cpSync(sourcePath, targetPath, { recursive: true });
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error(`❌ Error copying ${sourcePath} to ${targetPath}:`, error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Backs up the index.html file
|
|
74
|
+
*
|
|
75
|
+
* Needed when running the Connect Studio dev server on Windows
|
|
76
|
+
*/
|
|
77
|
+
function backupIndexHtml(appPath, restore = false) {
|
|
78
|
+
const filePath = join(appPath, "index.html");
|
|
79
|
+
const backupPath = join(appPath, "index.html.bak");
|
|
80
|
+
const paths = restore ? [backupPath, filePath] : [filePath, backupPath];
|
|
81
|
+
if (fs.existsSync(paths[0])) fs.copyFileSync(paths[0], paths[1]);
|
|
82
|
+
}
|
|
83
|
+
function removeBase64EnvValues(appPath) {
|
|
84
|
+
backupIndexHtml(appPath);
|
|
85
|
+
const filePath = join(appPath, "index.html");
|
|
86
|
+
fs.readFile(filePath, "utf-8", (err, data) => {
|
|
87
|
+
if (err) {
|
|
88
|
+
console.error("Error reading file:", err);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const modifiedData = data.replace(/"LOCAL_DOCUMENT_MODELS":\s*".*?",/, `"LOCAL_DOCUMENT_MODELS": "",`).replace(/"LOCAL_DOCUMENT_EDITORS":\s*".*?"/, `"LOCAL_DOCUMENT_EDITORS": ""`);
|
|
92
|
+
console.log("Modified data:", modifiedData);
|
|
93
|
+
fs.writeFile(filePath, modifiedData, "utf-8", (err) => {
|
|
94
|
+
if (err) {
|
|
95
|
+
console.error("Error writing file:", err);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function readJsonFile(filePath) {
|
|
102
|
+
try {
|
|
103
|
+
const absolutePath = resolve(filePath);
|
|
104
|
+
const fileContents = fs.readFileSync(absolutePath, "utf-8");
|
|
105
|
+
return JSON.parse(fileContents);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(`Error reading file: ${filePath}`);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Takes a list of Powerhouse project packages and optionally local Powerhouse packages and outputs a js file which exports those packages for use in Connect Studio.
|
|
113
|
+
*/
|
|
114
|
+
function makeImportScriptFromPackages(args) {
|
|
115
|
+
const { packages, localJsPath, localCssPath, importStyles = true } = args;
|
|
116
|
+
const imports = [];
|
|
117
|
+
const moduleNames = [];
|
|
118
|
+
let counter = 0;
|
|
119
|
+
for (const packageName of packages) {
|
|
120
|
+
const moduleName = `module${counter}`;
|
|
121
|
+
moduleNames.push(moduleName);
|
|
122
|
+
imports.push(`import * as ${moduleName} from '${packageName}';`);
|
|
123
|
+
if (importStyles) imports.push(`import '${packageName}/style.css';`);
|
|
124
|
+
counter++;
|
|
125
|
+
}
|
|
126
|
+
const exports = moduleNames.map((name, index) => `{
|
|
127
|
+
id: "${packages[index]}",
|
|
128
|
+
...${name},
|
|
129
|
+
}`);
|
|
130
|
+
const hasModule = localJsPath !== void 0;
|
|
131
|
+
const hasStyles = importStyles && localCssPath !== void 0;
|
|
132
|
+
if (hasModule || hasStyles) {
|
|
133
|
+
if (hasStyles) imports.push(`import '${localCssPath}';`);
|
|
134
|
+
if (hasModule) {
|
|
135
|
+
const moduleName = `module${counter}`;
|
|
136
|
+
imports.push(`import * as ${moduleName} from '${localJsPath}';`);
|
|
137
|
+
exports.push(`{
|
|
138
|
+
id: "${LOCAL_PACKAGE_ID}",
|
|
139
|
+
...${moduleName},
|
|
140
|
+
}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const exportStatement = `export default [${exports.length ? `
|
|
144
|
+
${exports.join(",\n")}
|
|
145
|
+
` : ""}];`;
|
|
146
|
+
return `${imports.join("\n")}\n\n${exportStatement}`;
|
|
147
|
+
}
|
|
148
|
+
function ensureNodeVersion(minVersion = "24") {
|
|
149
|
+
const version = process.versions.node;
|
|
150
|
+
if (!version) return;
|
|
151
|
+
if (version < minVersion) {
|
|
152
|
+
console.error(`Node version ${minVersion} or higher is required. Current version: ${version}`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function runShellScriptPlugin(scriptName, connectPath) {
|
|
157
|
+
return {
|
|
158
|
+
name: "vite-plugin-run-shell-script",
|
|
159
|
+
buildStart() {
|
|
160
|
+
const scriptPath = join(connectPath, scriptName);
|
|
161
|
+
if (fs.existsSync(scriptPath)) exec(`sh ${scriptPath}`, (error, stdout, stderr) => {
|
|
162
|
+
if (error) {
|
|
163
|
+
console.error(`Error executing the script: ${error.message}`);
|
|
164
|
+
removeBase64EnvValues(connectPath);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (stderr) console.error(stderr);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Shared helper to modify the <head> tag of an HTML file by transforming its contents.
|
|
174
|
+
*/
|
|
175
|
+
async function modifyHtmlHead(pathToHtml, contents, transform) {
|
|
176
|
+
if (!existsSync(pathToHtml)) throw new Error(`File ${pathToHtml} does not exist.`);
|
|
177
|
+
let html = await readFile(pathToHtml, "utf8");
|
|
178
|
+
html = transform(html, contents);
|
|
179
|
+
await writeFile(pathToHtml, html, "utf8");
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Appends the contents to the <head> tag of the index.html file
|
|
183
|
+
*/
|
|
184
|
+
async function appendToHtmlHead(pathToHtml, contents) {
|
|
185
|
+
return modifyHtmlHead(pathToHtml, contents, (html, contents) => {
|
|
186
|
+
if (!html.includes("</head>")) throw new Error("No </head> tag found in the HTML file.");
|
|
187
|
+
return html.replace("</head>", `\n${contents}\n</head>`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Prepends the contents to the <head> tag of the index.html file
|
|
192
|
+
*/
|
|
193
|
+
async function prependToHtmlHead(pathToHtml, contents) {
|
|
194
|
+
return modifyHtmlHead(pathToHtml, contents, (html, contents) => {
|
|
195
|
+
if (!html.includes("</head>")) throw new Error("No </head> tag found in the HTML file.");
|
|
196
|
+
return html.replace("<head>", `<head>\n${contents}\n`);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function runTsc(outDir) {
|
|
200
|
+
execSync(`npx tsc --outDir ${outDir}`, { stdio: "inherit" });
|
|
201
|
+
}
|
|
202
|
+
function stripVersionFromPackage(packageName) {
|
|
203
|
+
const trimmed = packageName.trim();
|
|
204
|
+
if (!trimmed) return "";
|
|
205
|
+
const lastAtIndex = trimmed.lastIndexOf("@");
|
|
206
|
+
if (lastAtIndex > 0) return trimmed.substring(0, lastAtIndex);
|
|
207
|
+
return trimmed;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region connect-utils/vite-plugins/favicon.ts
|
|
211
|
+
/**
|
|
212
|
+
* Vite plugin to serve the Connect favicon (icon.ico) from the connect package.
|
|
213
|
+
* This ensures the favicon is available in development and included in the production build.
|
|
214
|
+
*/
|
|
215
|
+
function connectFaviconPlugin() {
|
|
216
|
+
return {
|
|
217
|
+
name: "copy-connect-favicon",
|
|
218
|
+
configureServer(server) {
|
|
219
|
+
server.middlewares.use("/icon.ico", (_req, res, next) => {
|
|
220
|
+
server.pluginContainer.resolveId("@powerhousedao/connect/assets/icon.ico").then((resolved) => {
|
|
221
|
+
if (!resolved) return next();
|
|
222
|
+
res.setHeader("Content-Type", "image/x-icon");
|
|
223
|
+
res.end(readFileSync(resolved.id));
|
|
224
|
+
}).catch(() => next());
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
async generateBundle(_options, bundle) {
|
|
228
|
+
try {
|
|
229
|
+
if ("icon.ico" in bundle) return;
|
|
230
|
+
const resolved = await this.resolve("@powerhousedao/connect/assets/icon.ico");
|
|
231
|
+
if (!resolved) return;
|
|
232
|
+
this.emitFile({
|
|
233
|
+
type: "asset",
|
|
234
|
+
fileName: "icon.ico",
|
|
235
|
+
source: readFileSync(resolved.id)
|
|
236
|
+
});
|
|
237
|
+
} catch {}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region connect-utils/vite-plugins/ph-packages.ts
|
|
243
|
+
function phPackagesPlugin(options) {
|
|
244
|
+
const content = JSON.stringify({ packages: options.packages }, null, 2);
|
|
245
|
+
return {
|
|
246
|
+
name: "vite-plugin-ph-packages",
|
|
247
|
+
configureServer(server) {
|
|
248
|
+
server.middlewares.use((req, res, next) => {
|
|
249
|
+
if (req.url?.endsWith("/ph-packages.json")) {
|
|
250
|
+
res.setHeader("Content-Type", "application/json");
|
|
251
|
+
res.end(content);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
next();
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
hotUpdate: {
|
|
258
|
+
order: "pre",
|
|
259
|
+
handler(ctx) {
|
|
260
|
+
return ctx.modules.filter((mod) => {
|
|
261
|
+
if (mod.importers.size > 1) return true;
|
|
262
|
+
return !mod.importers.values().next().value?.file?.endsWith(".css");
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
generateBundle() {
|
|
267
|
+
this.emitFile({
|
|
268
|
+
type: "asset",
|
|
269
|
+
fileName: "ph-packages.json",
|
|
270
|
+
source: content
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region connect-utils/vite-config.ts
|
|
277
|
+
function getConnectHtmlTags(options = {}) {
|
|
278
|
+
const { registryUrl, injectTo = "head" } = options;
|
|
279
|
+
return [
|
|
280
|
+
{
|
|
281
|
+
tag: "meta",
|
|
282
|
+
attrs: {
|
|
283
|
+
"http-equiv": "Content-Security-Policy",
|
|
284
|
+
content: `script-src 'self' 'unsafe-inline' 'unsafe-eval' https://esm.sh${registryUrl ? " " + registryUrl : ""}; object-src 'none'; base-uri 'self';`
|
|
285
|
+
},
|
|
286
|
+
injectTo
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
tag: "meta",
|
|
290
|
+
attrs: {
|
|
291
|
+
property: "og:title",
|
|
292
|
+
content: "Connect"
|
|
293
|
+
},
|
|
294
|
+
injectTo
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
tag: "meta",
|
|
298
|
+
attrs: {
|
|
299
|
+
property: "og:type",
|
|
300
|
+
content: "website"
|
|
301
|
+
},
|
|
302
|
+
injectTo
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
tag: "meta",
|
|
306
|
+
attrs: {
|
|
307
|
+
property: "og:url",
|
|
308
|
+
content: "https://apps.powerhouse.io/powerhouse/connect/"
|
|
309
|
+
},
|
|
310
|
+
injectTo
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
tag: "meta",
|
|
314
|
+
attrs: {
|
|
315
|
+
property: "og:description",
|
|
316
|
+
content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation."
|
|
317
|
+
},
|
|
318
|
+
injectTo
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
tag: "meta",
|
|
322
|
+
attrs: {
|
|
323
|
+
property: "og:image",
|
|
324
|
+
content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e"
|
|
325
|
+
},
|
|
326
|
+
injectTo
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
tag: "meta",
|
|
330
|
+
attrs: {
|
|
331
|
+
name: "twitter:card",
|
|
332
|
+
content: "summary_large_image"
|
|
333
|
+
},
|
|
334
|
+
injectTo
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
tag: "meta",
|
|
338
|
+
attrs: {
|
|
339
|
+
name: "twitter:image",
|
|
340
|
+
content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e"
|
|
341
|
+
},
|
|
342
|
+
injectTo
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
tag: "meta",
|
|
346
|
+
attrs: {
|
|
347
|
+
name: "twitter:title",
|
|
348
|
+
content: "Connect"
|
|
349
|
+
},
|
|
350
|
+
injectTo
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
tag: "meta",
|
|
354
|
+
attrs: {
|
|
355
|
+
name: "twitter:description",
|
|
356
|
+
content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation."
|
|
357
|
+
},
|
|
358
|
+
injectTo
|
|
359
|
+
}
|
|
360
|
+
];
|
|
361
|
+
}
|
|
362
|
+
function viteLogger({ silence }) {
|
|
363
|
+
const logger = createLogger();
|
|
364
|
+
const loggerWarn = logger.warn.bind(logger);
|
|
365
|
+
const loggerError = logger.error.bind(logger);
|
|
366
|
+
logger.warn = (msg, options) => {
|
|
367
|
+
if (silence?.warnings?.some((warning) => msg.includes(warning))) return;
|
|
368
|
+
loggerWarn(msg, options);
|
|
369
|
+
};
|
|
370
|
+
logger.error = (msg, options) => {
|
|
371
|
+
if (silence?.errors?.some((error) => msg.includes(error))) return;
|
|
372
|
+
loggerError(msg, options);
|
|
373
|
+
};
|
|
374
|
+
return logger;
|
|
375
|
+
}
|
|
376
|
+
function getPackageNamesFromPowerhouseConfig({ packages }) {
|
|
377
|
+
if (!packages) return [];
|
|
378
|
+
return packages.map((p) => p.packageName);
|
|
379
|
+
}
|
|
380
|
+
function getConnectBaseViteConfig(options) {
|
|
381
|
+
const mode = options.mode;
|
|
382
|
+
const fileEnv = loadEnv(mode, options.envDir ?? options.dirname, "PH_");
|
|
383
|
+
const env = loadConnectEnv({
|
|
384
|
+
processEnv: process.env,
|
|
385
|
+
fileEnv
|
|
386
|
+
});
|
|
387
|
+
setConnectEnv(env);
|
|
388
|
+
const phConfigPath = env.PH_CONFIG_PATH ?? join(options.dirname, "powerhouse.config.json");
|
|
389
|
+
const phConfig = options.powerhouseConfig ?? getConfig(phConfigPath);
|
|
390
|
+
const packagesFromConfig = getPackageNamesFromPowerhouseConfig(phConfig);
|
|
391
|
+
const phPackages = env.PH_PACKAGES?.split(",") ?? packagesFromConfig;
|
|
392
|
+
const phPackageRegistryUrl = env.PH_CONNECT_PACKAGES_REGISTRY ?? phConfig.packageRegistryUrl ?? null;
|
|
393
|
+
const authToken = env.PH_SENTRY_AUTH_TOKEN;
|
|
394
|
+
const org = env.PH_SENTRY_ORG;
|
|
395
|
+
const project = env.PH_SENTRY_PROJECT;
|
|
396
|
+
const release = env.PH_CONNECT_SENTRY_RELEASE || env.PH_CONNECT_VERSION;
|
|
397
|
+
const uploadSentrySourcemaps = authToken && org && project;
|
|
398
|
+
const connectHtmlTags = getConnectHtmlTags({ registryUrl: phPackageRegistryUrl });
|
|
399
|
+
const plugins = [
|
|
400
|
+
tailwind(),
|
|
401
|
+
react(),
|
|
402
|
+
createHtmlPlugin({
|
|
403
|
+
minify: false,
|
|
404
|
+
inject: { tags: [...connectHtmlTags, {
|
|
405
|
+
tag: "script",
|
|
406
|
+
attrs: { type: "importmap" },
|
|
407
|
+
children: JSON.stringify({ imports: {
|
|
408
|
+
react: "https://esm.sh/react@19.2.0",
|
|
409
|
+
"react/": "https://esm.sh/react@19.2.0/",
|
|
410
|
+
"react-dom": "https://esm.sh/react-dom@19.2.0",
|
|
411
|
+
"react-dom/": "https://esm.sh/react-dom@19.2.0/"
|
|
412
|
+
} }, null, 2),
|
|
413
|
+
injectTo: "head-prepend"
|
|
414
|
+
}] }
|
|
415
|
+
})
|
|
416
|
+
];
|
|
417
|
+
if (uploadSentrySourcemaps) plugins.push(sentryVitePlugin({
|
|
418
|
+
release: {
|
|
419
|
+
name: release ?? "unknown",
|
|
420
|
+
inject: false
|
|
421
|
+
},
|
|
422
|
+
authToken,
|
|
423
|
+
org,
|
|
424
|
+
project,
|
|
425
|
+
bundleSizeOptimizations: { excludeDebugStatements: true },
|
|
426
|
+
reactComponentAnnotation: { enabled: true }
|
|
427
|
+
}));
|
|
428
|
+
const customLogger = process.env.LOG_LEVEL === "debug" || env.PH_CONNECT_LOG_LEVEL === "debug" ? void 0 : viteLogger({ silence: {
|
|
429
|
+
warnings: ["@import must precede all other statements (besides @charset or empty @layer)"],
|
|
430
|
+
errors: ["Unterminated string literal"]
|
|
431
|
+
} });
|
|
432
|
+
const reactExternal = [
|
|
433
|
+
"react",
|
|
434
|
+
"react-dom",
|
|
435
|
+
"react/jsx-runtime",
|
|
436
|
+
"react-dom/client"
|
|
437
|
+
];
|
|
438
|
+
return {
|
|
439
|
+
configFile: false,
|
|
440
|
+
mode,
|
|
441
|
+
server: { watch: { ignored: ["**/backup-documents/**", "**/.ph/**"] } },
|
|
442
|
+
resolve: {
|
|
443
|
+
dedupe: ["react", "react-dom"],
|
|
444
|
+
tsconfigPaths: true
|
|
445
|
+
},
|
|
446
|
+
define: { PH_PACKAGE_REGISTRY_URL: `"${phPackageRegistryUrl}"` },
|
|
447
|
+
customLogger,
|
|
448
|
+
envPrefix: ["PH_CONNECT_"],
|
|
449
|
+
optimizeDeps: {
|
|
450
|
+
include: [
|
|
451
|
+
"document-model",
|
|
452
|
+
"zod",
|
|
453
|
+
"@powerhousedao/design-system/connect",
|
|
454
|
+
"@powerhousedao/reactor-browser",
|
|
455
|
+
"@powerhousedao/document-engineering"
|
|
456
|
+
],
|
|
457
|
+
exclude: ["@electric-sql/pglite", "@electric-sql/pglite-tools"]
|
|
458
|
+
},
|
|
459
|
+
plugins: [
|
|
460
|
+
phPackagesPlugin({ packages: phPackages }),
|
|
461
|
+
...plugins,
|
|
462
|
+
esmExternalRequirePlugin({ external: reactExternal }),
|
|
463
|
+
connectFaviconPlugin()
|
|
464
|
+
],
|
|
465
|
+
worker: { format: "es" },
|
|
466
|
+
build: { sourcemap: true }
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
//#endregion
|
|
470
|
+
export { DEFAULT_CONNECT_OUTDIR, EXTERNAL_PACKAGES_IMPORT, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, PH_DIR_NAME, appendToHtmlHead, backupIndexHtml, commonConnectOptionsToEnv, copyConnect, ensureNodeVersion, getConnectBaseViteConfig, getConnectHtmlTags, makeImportScriptFromPackages, phPackagesPlugin, prependToHtmlHead, readJsonFile, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolvePackage, resolveViteConfigPath, runShellScriptPlugin, runTsc, stripVersionFromPackage };
|
|
471
|
+
|
|
472
|
+
//# sourceMappingURL=index.mjs.map
|