@mnaoumov/obsidian-dev-toolkit 0.0.0 → 1.0.0
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/LICENSE +21 -0
- package/README.md +7 -1
- package/bundlers/esbuild/package.json +6 -0
- package/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/dependency/package.json +6 -0
- package/bundlers/esbuild-impl/fix-source-maps-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/index/package.json +6 -0
- package/bundlers/esbuild-impl/obsidian-plugin-builder/package.json +6 -0
- package/bundlers/esbuild-impl/package.json +6 -0
- package/bundlers/esbuild-impl/preprocess-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/rename-css-plugin/package.json +6 -0
- package/bundlers/index/package.json +6 -0
- package/bundlers/package.json +6 -0
- package/dist/demo-vault-helper/main.js +782 -0
- package/dist/demo-vault-helper/manifest.json +9 -0
- package/dist/integration-test-plugin/main.js +45388 -0
- package/dist/integration-test-plugin/manifest.json +8 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.cjs +335 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.d.cts +38 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/dependency.cjs +253 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/dependency.d.cts +20 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/fix-source-maps-plugin.cjs +226 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/fix-source-maps-plugin.d.cts +34 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/index.cjs +192 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/index.d.cts +7 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/obsidian-plugin-builder.cjs +375 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/obsidian-plugin-builder.d.cts +98 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/preprocess-plugin.cjs +247 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/preprocess-plugin.d.cts +30 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/rename-css-plugin.cjs +184 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/rename-css-plugin.d.cts +14 -0
- package/dist/lib/cjs/bundlers/esbuild.cjs +177 -0
- package/dist/lib/cjs/bundlers/esbuild.d.cts +11 -0
- package/dist/lib/cjs/bundlers/index.cjs +180 -0
- package/dist/lib/cjs/bundlers/index.d.cts +3 -0
- package/dist/lib/cjs/demo-vault-app-json.cjs +199 -0
- package/dist/lib/cjs/demo-vault-app-json.d.cts +93 -0
- package/dist/lib/cjs/demo-vault-buttons.cjs +580 -0
- package/dist/lib/cjs/demo-vault-buttons.d.cts +259 -0
- package/dist/lib/cjs/demo-vault-coverage.cjs +725 -0
- package/dist/lib/cjs/demo-vault-coverage.d.cts +533 -0
- package/dist/lib/cjs/demo-vault.cjs +309 -0
- package/dist/lib/cjs/demo-vault.d.cts +33 -0
- package/dist/lib/cjs/formatters/dprint.cjs +173 -0
- package/dist/lib/cjs/formatters/dprint.d.cts +15 -0
- package/dist/lib/cjs/formatters/index.cjs +177 -0
- package/dist/lib/cjs/formatters/index.d.cts +2 -0
- package/dist/lib/cjs/index.cjs +207 -0
- package/dist/lib/cjs/index.d.cts +16 -0
- package/dist/lib/cjs/integration-test-setup.cjs +142 -0
- package/dist/lib/cjs/integration-test-setup.d.cts +33 -0
- package/dist/lib/cjs/integration-test-vitest-global-setup.cjs +176 -0
- package/dist/lib/cjs/integration-test-vitest-global-setup.d.cts +39 -0
- package/dist/lib/cjs/jest-setup.cjs +147 -0
- package/dist/lib/cjs/jest-setup.d.cts +13 -0
- package/dist/lib/cjs/linters/eslint-config.cjs +365 -0
- package/dist/lib/cjs/linters/eslint-config.d.cts +25 -0
- package/dist/lib/cjs/linters/eslint-rules/index.cjs +201 -0
- package/dist/lib/cjs/linters/eslint-rules/index.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-description.cjs +268 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-description.d.cts +54 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-helpers.cjs +231 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-helpers.d.cts +141 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-id.cjs +228 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-id.d.cts +32 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-name.cjs +229 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-name.d.cts +30 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-schema.cjs +329 -0
- package/dist/lib/cjs/linters/eslint-rules/manifest-schema.d.cts +45 -0
- package/dist/lib/cjs/linters/eslint-rules/no-over-cap-wait-in-eval-in-obsidian.cjs +670 -0
- package/dist/lib/cjs/linters/eslint-rules/no-over-cap-wait-in-eval-in-obsidian.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/no-untrusted-input-events.cjs +260 -0
- package/dist/lib/cjs/linters/eslint-rules/no-untrusted-input-events.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/obsidian-dev-utils-plugin.cjs +186 -0
- package/dist/lib/cjs/linters/eslint-rules/obsidian-dev-utils-plugin.d.cts +13 -0
- package/dist/lib/cjs/linters/eslint-rules/require-component-suffix.cjs +291 -0
- package/dist/lib/cjs/linters/eslint-rules/require-component-suffix.d.cts +18 -0
- package/dist/lib/cjs/linters/eslint.cjs +173 -0
- package/dist/lib/cjs/linters/eslint.d.cts +15 -0
- package/dist/lib/cjs/linters/index.cjs +189 -0
- package/dist/lib/cjs/linters/index.d.cts +6 -0
- package/dist/lib/cjs/linters/markdownlint.cjs +173 -0
- package/dist/lib/cjs/linters/markdownlint.d.cts +15 -0
- package/dist/lib/cjs/linters/obsidianmd-rule-custom-message.cjs +189 -0
- package/dist/lib/cjs/linters/obsidianmd-rule-custom-message.d.cts +40 -0
- package/dist/lib/cjs/obsidian-plugin-repo-paths.cjs +229 -0
- package/dist/lib/cjs/obsidian-plugin-repo-paths.d.cts +253 -0
- package/dist/lib/cjs/setup.cjs +176 -0
- package/dist/lib/cjs/setup.d.cts +21 -0
- package/dist/lib/cjs/templates.cjs +185 -0
- package/dist/lib/cjs/templates.d.cts +13 -0
- package/dist/lib/cjs/test-runners/index.cjs +183 -0
- package/dist/lib/cjs/test-runners/index.d.cts +4 -0
- package/dist/lib/cjs/test-runners/integration-test-plugin.cjs +224 -0
- package/dist/lib/cjs/test-runners/integration-test-plugin.d.cts +44 -0
- package/dist/lib/cjs/test-runners/performance-eval-cap.cjs +170 -0
- package/dist/lib/cjs/test-runners/performance-eval-cap.d.cts +27 -0
- package/dist/lib/cjs/test-runners/stale-build-global-setup.cjs +230 -0
- package/dist/lib/cjs/test-runners/stale-build-global-setup.d.cts +86 -0
- package/dist/lib/cjs/test-runners/vitest-config.cjs +497 -0
- package/dist/lib/cjs/test-runners/vitest-config.d.cts +200 -0
- package/dist/lib/cjs/version.cjs +275 -0
- package/dist/lib/cjs/version.d.cts +92 -0
- package/dist/lib/cjs/vitest-setup.cjs +147 -0
- package/dist/lib/cjs/vitest-setup.d.cts +11 -0
- package/dist/lib/esm/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.d.mts +38 -0
- package/dist/lib/esm/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.mjs +226 -0
- package/dist/lib/esm/bundlers/esbuild-impl/dependency.d.mts +20 -0
- package/dist/lib/esm/bundlers/esbuild-impl/dependency.mjs +138 -0
- package/dist/lib/esm/bundlers/esbuild-impl/fix-source-maps-plugin.d.mts +34 -0
- package/dist/lib/esm/bundlers/esbuild-impl/fix-source-maps-plugin.mjs +116 -0
- package/dist/lib/esm/bundlers/esbuild-impl/index.d.mts +7 -0
- package/dist/lib/esm/bundlers/esbuild-impl/index.mjs +64 -0
- package/dist/lib/esm/bundlers/esbuild-impl/obsidian-plugin-builder.d.mts +98 -0
- package/dist/lib/esm/bundlers/esbuild-impl/obsidian-plugin-builder.mjs +255 -0
- package/dist/lib/esm/bundlers/esbuild-impl/preprocess-plugin.d.mts +30 -0
- package/dist/lib/esm/bundlers/esbuild-impl/preprocess-plugin.mjs +134 -0
- package/dist/lib/esm/bundlers/esbuild-impl/rename-css-plugin.d.mts +14 -0
- package/dist/lib/esm/bundlers/esbuild-impl/rename-css-plugin.mjs +71 -0
- package/dist/lib/esm/bundlers/esbuild.d.mts +11 -0
- package/dist/lib/esm/bundlers/esbuild.mjs +66 -0
- package/dist/lib/esm/bundlers/index.d.mts +3 -0
- package/dist/lib/esm/bundlers/index.mjs +56 -0
- package/dist/lib/esm/demo-vault-app-json.d.mts +93 -0
- package/dist/lib/esm/demo-vault-app-json.mjs +83 -0
- package/dist/lib/esm/demo-vault-buttons.d.mts +259 -0
- package/dist/lib/esm/demo-vault-buttons.mjs +460 -0
- package/dist/lib/esm/demo-vault-coverage.d.mts +533 -0
- package/dist/lib/esm/demo-vault-coverage.mjs +626 -0
- package/dist/lib/esm/demo-vault.d.mts +33 -0
- package/dist/lib/esm/demo-vault.mjs +205 -0
- package/dist/lib/esm/formatters/dprint.d.mts +15 -0
- package/dist/lib/esm/formatters/dprint.mjs +60 -0
- package/dist/lib/esm/formatters/index.d.mts +2 -0
- package/dist/lib/esm/formatters/index.mjs +54 -0
- package/dist/lib/esm/index.d.mts +16 -0
- package/dist/lib/esm/index.mjs +74 -0
- package/dist/lib/esm/integration-test-setup.d.mts +33 -0
- package/dist/lib/esm/integration-test-setup.mjs +52 -0
- package/dist/lib/esm/integration-test-vitest-global-setup.d.mts +39 -0
- package/dist/lib/esm/integration-test-vitest-global-setup.mjs +65 -0
- package/dist/lib/esm/jest-setup.d.mts +13 -0
- package/dist/lib/esm/jest-setup.mjs +61 -0
- package/dist/lib/esm/linters/eslint-config.d.mts +25 -0
- package/dist/lib/esm/linters/eslint-config.mjs +247 -0
- package/dist/lib/esm/linters/eslint-rules/index.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/index.mjs +70 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-description.d.mts +54 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-description.mjs +154 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-helpers.d.mts +141 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-helpers.mjs +98 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-id.d.mts +32 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-id.mjs +117 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-name.d.mts +30 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-name.mjs +118 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-schema.d.mts +45 -0
- package/dist/lib/esm/linters/eslint-rules/manifest-schema.mjs +220 -0
- package/dist/lib/esm/linters/eslint-rules/no-over-cap-wait-in-eval-in-obsidian.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/no-over-cap-wait-in-eval-in-obsidian.mjs +559 -0
- package/dist/lib/esm/linters/eslint-rules/no-untrusted-input-events.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/no-untrusted-input-events.mjs +146 -0
- package/dist/lib/esm/linters/eslint-rules/obsidian-dev-utils-plugin.d.mts +13 -0
- package/dist/lib/esm/linters/eslint-rules/obsidian-dev-utils-plugin.mjs +73 -0
- package/dist/lib/esm/linters/eslint-rules/require-component-suffix.d.mts +18 -0
- package/dist/lib/esm/linters/eslint-rules/require-component-suffix.mjs +175 -0
- package/dist/lib/esm/linters/eslint.d.mts +15 -0
- package/dist/lib/esm/linters/eslint.mjs +60 -0
- package/dist/lib/esm/linters/index.d.mts +6 -0
- package/dist/lib/esm/linters/index.mjs +62 -0
- package/dist/lib/esm/linters/markdownlint.d.mts +15 -0
- package/dist/lib/esm/linters/markdownlint.mjs +60 -0
- package/dist/lib/esm/linters/obsidianmd-rule-custom-message.d.mts +40 -0
- package/dist/lib/esm/linters/obsidianmd-rule-custom-message.mjs +75 -0
- package/dist/lib/esm/obsidian-plugin-repo-paths.d.mts +253 -0
- package/dist/lib/esm/obsidian-plugin-repo-paths.mjs +116 -0
- package/dist/lib/esm/setup.d.mts +21 -0
- package/dist/lib/esm/setup.mjs +63 -0
- package/dist/lib/esm/templates.d.mts +13 -0
- package/dist/lib/esm/templates.mjs +65 -0
- package/dist/lib/esm/test-runners/index.d.mts +4 -0
- package/dist/lib/esm/test-runners/index.mjs +58 -0
- package/dist/lib/esm/test-runners/integration-test-plugin.d.mts +44 -0
- package/dist/lib/esm/test-runners/integration-test-plugin.mjs +102 -0
- package/dist/lib/esm/test-runners/performance-eval-cap.d.mts +27 -0
- package/dist/lib/esm/test-runners/performance-eval-cap.mjs +56 -0
- package/dist/lib/esm/test-runners/stale-build-global-setup.d.mts +86 -0
- package/dist/lib/esm/test-runners/stale-build-global-setup.mjs +123 -0
- package/dist/lib/esm/test-runners/vitest-config.d.mts +200 -0
- package/dist/lib/esm/test-runners/vitest-config.mjs +377 -0
- package/dist/lib/esm/version.d.mts +92 -0
- package/dist/lib/esm/version.mjs +168 -0
- package/dist/lib/esm/vitest-setup.d.mts +11 -0
- package/dist/lib/esm/vitest-setup.mjs +61 -0
- package/dist/templates/.markdownlint-cli2.mjs +4 -0
- package/dist/templates/.nano-staged.mjs +4 -0
- package/dist/templates/commitlint.config.ts +3 -0
- package/dist/templates/dprint.json +26 -0
- package/dist/templates/eslint.config.mts +3 -0
- package/dist/templates/scripts/build/build-clean.ts +4 -0
- package/dist/templates/scripts/build/build-compile-svelte.ts +4 -0
- package/dist/templates/scripts/build/build-compile-typescript.ts +4 -0
- package/dist/templates/scripts/build/build-compile.ts +4 -0
- package/dist/templates/scripts/build/build-templates.ts +4 -0
- package/dist/templates/scripts/bundlers/esbuild/build.ts +4 -0
- package/dist/templates/scripts/bundlers/esbuild/dev.ts +4 -0
- package/dist/templates/scripts/commitlint-config.ts +3 -0
- package/dist/templates/scripts/eslint-config.ts +10 -0
- package/dist/templates/scripts/formatters/dprint/format-check.ts +8 -0
- package/dist/templates/scripts/formatters/dprint/format.ts +8 -0
- package/dist/templates/scripts/gate/gate.ts +10 -0
- package/dist/templates/scripts/linters/cspell/spellcheck.ts +8 -0
- package/dist/templates/scripts/linters/eslint/lint-fix.ts +8 -0
- package/dist/templates/scripts/linters/eslint/lint.ts +8 -0
- package/dist/templates/scripts/linters/markdownlint/lint-md-fix.ts +8 -0
- package/dist/templates/scripts/linters/markdownlint/lint-md.ts +8 -0
- package/dist/templates/scripts/linters/over-exposure/find-overexposed-fix.ts +25 -0
- package/dist/templates/scripts/linters/over-exposure/find-overexposed.ts +15 -0
- package/dist/templates/scripts/markdownlint-cli2-config.ts +3 -0
- package/dist/templates/scripts/nano-staged-config.ts +3 -0
- package/dist/templates/scripts/test-runners/vitest/test-coverage.ts +4 -0
- package/dist/templates/scripts/test-runners/vitest/test-watch.ts +4 -0
- package/dist/templates/scripts/test-runners/vitest/test.ts +4 -0
- package/dist/templates/scripts/version/version.ts +10 -0
- package/dist/templates/scripts/vitest-config.ts +3 -0
- package/dist/templates/vitest.config.ts +3 -0
- package/formatters/dprint/package.json +6 -0
- package/formatters/index/package.json +6 -0
- package/formatters/package.json +6 -0
- package/linters/eslint/package.json +6 -0
- package/linters/eslint-config/package.json +6 -0
- package/linters/eslint-rules/index/package.json +6 -0
- package/linters/eslint-rules/manifest-description/package.json +6 -0
- package/linters/eslint-rules/manifest-helpers/package.json +6 -0
- package/linters/eslint-rules/manifest-id/package.json +6 -0
- package/linters/eslint-rules/manifest-name/package.json +6 -0
- package/linters/eslint-rules/manifest-schema/package.json +6 -0
- package/linters/eslint-rules/no-over-cap-wait-in-eval-in-obsidian/package.json +6 -0
- package/linters/eslint-rules/no-untrusted-input-events/package.json +6 -0
- package/linters/eslint-rules/obsidian-dev-utils-plugin/package.json +6 -0
- package/linters/eslint-rules/package.json +6 -0
- package/linters/eslint-rules/require-component-suffix/package.json +6 -0
- package/linters/index/package.json +6 -0
- package/linters/markdownlint/package.json +6 -0
- package/linters/obsidianmd-rule-custom-message/package.json +6 -0
- package/linters/package.json +6 -0
- package/package.json +241 -13
- package/test-runners/index/package.json +6 -0
- package/test-runners/integration-test-plugin/package.json +6 -0
- package/test-runners/package.json +6 -0
- package/test-runners/performance-eval-cap/package.json +6 -0
- package/test-runners/stale-build-global-setup/package.json +6 -0
- package/test-runners/vitest-config/package.json +6 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference path="../index.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Wires the shipped integration-test harness plugin into a consumer plugin's integration tests, so every
|
|
6
|
+
* library helper is reachable as `lib.<helper>` inside an `evalInObsidian` closure.
|
|
7
|
+
*
|
|
8
|
+
* Two halves, and both must be wired or `lib.<helper>` fails:
|
|
9
|
+
*
|
|
10
|
+
* - {@link getIntegrationTestPluginPopulate} puts the harness plugin's binaries in the test vault. The
|
|
11
|
+
* harness plugin is what publishes the library on `window.__obsidianDevUtilsModule`; in this repo's own
|
|
12
|
+
* suite it IS the plugin-under-test, but in a consumer's suite the plugin-under-test is the consumer's own
|
|
13
|
+
* plugin, so the harness has to ride along as a second, test-only community plugin — seeded here, and
|
|
14
|
+
* turned on by `obsidian-integration-testing`'s `createSetup({ enableCommunityPlugins })`.
|
|
15
|
+
* - {@link registerIntegrationTestLibResolver} registers the renderer-side resolver that reads that global.
|
|
16
|
+
*
|
|
17
|
+
* `obsidian-dev-utils/integration-test-vitest-global-setup` and
|
|
18
|
+
* `obsidian-dev-utils/integration-test-setup` are the turnkey endpoints that call these for you.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The id of the integration-test harness plugin — the folder name it is seeded into, and the value to pass
|
|
22
|
+
* to `createSetup({ enableCommunityPlugins })` so the harness enables it after the plugin-under-test.
|
|
23
|
+
*/
|
|
24
|
+
export declare const OBSIDIAN_DEV_UTILS_INTEGRATION_TEST_PLUGIN_ID = "obsidian-dev-utils-integration-test";
|
|
25
|
+
/**
|
|
26
|
+
* Builds the vault-relative file map that installs the shipped integration-test harness plugin, ready to
|
|
27
|
+
* hand to a global setup's `populate` (or to merge into a larger map the consumer already builds).
|
|
28
|
+
*
|
|
29
|
+
* The result is a `Record<string, Uint8Array>`, which is assignable to `obsidian-integration-testing`'s
|
|
30
|
+
* `PopulateFilesParams` — so it composes with `buildDemoVaultPopulate` and friends.
|
|
31
|
+
*
|
|
32
|
+
* @returns The map of vault-relative paths to file contents.
|
|
33
|
+
* @throws If the harness plugin was not built into this package — i.e. `npm run build` never ran.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getIntegrationTestPluginPopulate(): Record<string, Uint8Array>;
|
|
36
|
+
/**
|
|
37
|
+
* Registers the renderer-side resolver that merges the whole library into the `lib` argument of every
|
|
38
|
+
* `evalInObsidian` callback, reading it from the global the harness plugin publishes.
|
|
39
|
+
*
|
|
40
|
+
* Call once per test worker — the published `obsidian-dev-utils/integration-test-setup` endpoint does it
|
|
41
|
+
* for you when listed in `setupFiles`. Registration is idempotent (the harness dedupes resolvers by source
|
|
42
|
+
* text), so calling it more than once is safe.
|
|
43
|
+
*/
|
|
44
|
+
export declare function registerIntegrationTestLibResolver(): void;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function () {
|
|
7
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
8
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for('Symbol.asyncDispose');
|
|
9
|
+
symbolConstructor.dispose ??= symbolConstructor.for('Symbol.dispose');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureBrowserProcess() {
|
|
13
|
+
const browserProcess = {
|
|
14
|
+
browser: true,
|
|
15
|
+
cwd() {
|
|
16
|
+
return '/';
|
|
17
|
+
},
|
|
18
|
+
env: {},
|
|
19
|
+
platform: 'android'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line obsidianmd/no-global-this, unicorn/no-unnecessary-global-this -- Must stay `globalThis`-qualified: in the emitted banner a bare `process` is a free identifier, so reading it where the host has none throws a ReferenceError instead of yielding `undefined`. That is the very case this function exists to handle.
|
|
23
|
+
const existingProcess = globalThis.process;
|
|
24
|
+
|
|
25
|
+
if (!existingProcess) {
|
|
26
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
27
|
+
globalThis.process = browserProcess;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (existingProcess.versions?.node) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const existingProcessRecord = existingProcess;
|
|
36
|
+
|
|
37
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
38
|
+
existingProcessRecord[key] ??= value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
existingProcessRecord['browser'] = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function keepName($unknown) {
|
|
45
|
+
return $unknown;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
(function initCjs() {
|
|
49
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
50
|
+
const globalThisRecord = globalThis;
|
|
51
|
+
ensureDisposeSymbols();
|
|
52
|
+
globalThisRecord['__name'] ??= keepName;
|
|
53
|
+
globalThisRecord['__extractDefault'] ??= extractDefault;
|
|
54
|
+
|
|
55
|
+
ensureBrowserProcess();
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping -- Serialized with initCjs into the banner; at module scope it would be left out of it.
|
|
58
|
+
function extractDefault(module) {
|
|
59
|
+
return module && module.__esModule && 'default' in module ? module.default : module;
|
|
60
|
+
}
|
|
61
|
+
})();
|
|
62
|
+
})();
|
|
63
|
+
(function patchObsidianRequire() {
|
|
64
|
+
const originalRequire = require;
|
|
65
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line no-global-assign, no-implicit-globals -- We need to patch the `require()` function.
|
|
70
|
+
require = Object.assign(
|
|
71
|
+
(id) => requirePatched(id),
|
|
72
|
+
originalRequire,
|
|
73
|
+
{
|
|
74
|
+
__isPatched: true
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
function extractDefault(module) {
|
|
79
|
+
return module && module.__esModule && 'default' in module ? module.default : module;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = new Set([
|
|
83
|
+
'@codemirror/autocomplete',
|
|
84
|
+
'@codemirror/collab',
|
|
85
|
+
'@codemirror/commands',
|
|
86
|
+
'@codemirror/language',
|
|
87
|
+
'@codemirror/lint',
|
|
88
|
+
'@codemirror/search',
|
|
89
|
+
'@codemirror/state',
|
|
90
|
+
'@codemirror/text',
|
|
91
|
+
'@codemirror/view',
|
|
92
|
+
'@lezer/common',
|
|
93
|
+
'@lezer/highlight',
|
|
94
|
+
'@lezer/lr',
|
|
95
|
+
'obsidian']
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = new Set([
|
|
99
|
+
'@codemirror/closebrackets',
|
|
100
|
+
'@codemirror/comment',
|
|
101
|
+
'@codemirror/fold',
|
|
102
|
+
'@codemirror/gutter',
|
|
103
|
+
'@codemirror/highlight',
|
|
104
|
+
'@codemirror/history',
|
|
105
|
+
'@codemirror/matchbrackets',
|
|
106
|
+
'@codemirror/panel',
|
|
107
|
+
'@codemirror/rangeset',
|
|
108
|
+
'@codemirror/rectangular-selection',
|
|
109
|
+
'@codemirror/stream-parser',
|
|
110
|
+
'@codemirror/tooltip']
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
function requirePatched(id) {
|
|
114
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
115
|
+
return originalRequire?.(id);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated, obsidianmd/no-global-this -- Need access to app. Actively use globalThis.
|
|
119
|
+
if (globalThis.app.isMobile) {
|
|
120
|
+
if (id === 'process' || id === 'node:process') {
|
|
121
|
+
// eslint-disable-next-line no-console -- Valid usage.
|
|
122
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
123
|
+
|
|
124
|
+
return process;
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
const module = originalRequire?.(id);
|
|
128
|
+
if (module) {
|
|
129
|
+
return extractDefault(module);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line no-console -- Valid usage.
|
|
134
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
138
|
+
|
|
139
|
+
"use strict";
|
|
140
|
+
var __defProp = Object.defineProperty;
|
|
141
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
142
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
143
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
144
|
+
var __export = (target, all) => {
|
|
145
|
+
for (var name in all)
|
|
146
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
147
|
+
};
|
|
148
|
+
var __copyProps = (to, from, except, desc) => {
|
|
149
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
150
|
+
for (let key of __getOwnPropNames(from))
|
|
151
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
152
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
153
|
+
}
|
|
154
|
+
return to;
|
|
155
|
+
};
|
|
156
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
157
|
+
var performance_eval_cap_exports = {};
|
|
158
|
+
__export(performance_eval_cap_exports, {
|
|
159
|
+
DESKTOP_PERFORMANCE_TEST_FILE_SUFFIX: () => DESKTOP_PERFORMANCE_TEST_FILE_SUFFIX,
|
|
160
|
+
PERFORMANCE_EVAL_CAP_IN_MILLISECONDS: () => PERFORMANCE_EVAL_CAP_IN_MILLISECONDS
|
|
161
|
+
});
|
|
162
|
+
module.exports = __toCommonJS(performance_eval_cap_exports);
|
|
163
|
+
const PERFORMANCE_EVAL_CAP_IN_MILLISECONDS = 6e5;
|
|
164
|
+
const DESKTOP_PERFORMANCE_TEST_FILE_SUFFIX = ".desktop-performance.integration.test.ts";
|
|
165
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
166
|
+
0 && (module.exports = {
|
|
167
|
+
DESKTOP_PERFORMANCE_TEST_FILE_SUFFIX,
|
|
168
|
+
PERFORMANCE_EVAL_CAP_IN_MILLISECONDS
|
|
169
|
+
});
|
|
170
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL3Rlc3QtcnVubmVycy9wZXJmb3JtYW5jZS1ldmFsLWNhcC50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAZmlsZVxuICpcbiAqIFRoZSBwZXItZXZhbCBjYXAgb2YgdGhlIGBpbnRlZ3JhdGlvbi10ZXN0czpkZXNrdG9wLXBlcmZvcm1hbmNlYCBwcm9qZWN0LCBhbmQgdGhlIGZpbGUgc3VmZml4IHRoYXRcbiAqIHByb2plY3QgY29sbGVjdHMuXG4gKlxuICogQm90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0,0 +1,27 @@
|
|
|
1
|
+
/// <reference path="../index.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* The per-eval cap of the `integration-tests:desktop-performance` project, and the file suffix that
|
|
6
|
+
* project collects.
|
|
7
|
+
*
|
|
8
|
+
* Both live here, rather than in `vitest-config.ts`, because the `no-over-cap-wait-in-eval-in-obsidian`
|
|
9
|
+
* ESLint rule reads them too, and the shared ESLint config loads that rule in every consuming repo:
|
|
10
|
+
* importing `vitest-config.ts` from the rule would load `vitest/config` at lint time for nothing.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The per-eval cap the `integration-tests:desktop-performance` project gives its CDP transport, in
|
|
14
|
+
* milliseconds.
|
|
15
|
+
*
|
|
16
|
+
* Every other project keeps the transport's own `DEFAULT_EVAL_CAP_IN_MILLISECONDS` (30 000), and a repo
|
|
17
|
+
* that raises its desktop cap above that is setting a BACKSTOP, not a budget a closure may spend. The
|
|
18
|
+
* performance project is the one exception, and a deliberate one: its whole measurement is one long
|
|
19
|
+
* in-page `Runtime.evaluate` over a vault of tens of thousands of notes, and its files run on no other
|
|
20
|
+
* project. A cross-platform suite gains nothing from any desktop raise, because Appium caps it at
|
|
21
|
+
* 30 000 whatever the desktop project says.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PERFORMANCE_EVAL_CAP_IN_MILLISECONDS = 600000;
|
|
24
|
+
/**
|
|
25
|
+
* The file-name suffix of a suite the `integration-tests:desktop-performance` project collects.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DESKTOP_PERFORMANCE_TEST_FILE_SUFFIX = ".desktop-performance.integration.test.ts";
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function () {
|
|
7
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
8
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for('Symbol.asyncDispose');
|
|
9
|
+
symbolConstructor.dispose ??= symbolConstructor.for('Symbol.dispose');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureBrowserProcess() {
|
|
13
|
+
const browserProcess = {
|
|
14
|
+
browser: true,
|
|
15
|
+
cwd() {
|
|
16
|
+
return '/';
|
|
17
|
+
},
|
|
18
|
+
env: {},
|
|
19
|
+
platform: 'android'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line obsidianmd/no-global-this, unicorn/no-unnecessary-global-this -- Must stay `globalThis`-qualified: in the emitted banner a bare `process` is a free identifier, so reading it where the host has none throws a ReferenceError instead of yielding `undefined`. That is the very case this function exists to handle.
|
|
23
|
+
const existingProcess = globalThis.process;
|
|
24
|
+
|
|
25
|
+
if (!existingProcess) {
|
|
26
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
27
|
+
globalThis.process = browserProcess;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (existingProcess.versions?.node) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const existingProcessRecord = existingProcess;
|
|
36
|
+
|
|
37
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
38
|
+
existingProcessRecord[key] ??= value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
existingProcessRecord['browser'] = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function keepName($unknown) {
|
|
45
|
+
return $unknown;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
(function initCjs() {
|
|
49
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
50
|
+
const globalThisRecord = globalThis;
|
|
51
|
+
ensureDisposeSymbols();
|
|
52
|
+
globalThisRecord['__name'] ??= keepName;
|
|
53
|
+
globalThisRecord['__extractDefault'] ??= extractDefault;
|
|
54
|
+
|
|
55
|
+
ensureBrowserProcess();
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping -- Serialized with initCjs into the banner; at module scope it would be left out of it.
|
|
58
|
+
function extractDefault(module) {
|
|
59
|
+
return module && module.__esModule && 'default' in module ? module.default : module;
|
|
60
|
+
}
|
|
61
|
+
})();
|
|
62
|
+
})();
|
|
63
|
+
(function patchObsidianRequire() {
|
|
64
|
+
const originalRequire = require;
|
|
65
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line no-global-assign, no-implicit-globals -- We need to patch the `require()` function.
|
|
70
|
+
require = Object.assign(
|
|
71
|
+
(id) => requirePatched(id),
|
|
72
|
+
originalRequire,
|
|
73
|
+
{
|
|
74
|
+
__isPatched: true
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
function extractDefault(module) {
|
|
79
|
+
return module && module.__esModule && 'default' in module ? module.default : module;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = new Set([
|
|
83
|
+
'@codemirror/autocomplete',
|
|
84
|
+
'@codemirror/collab',
|
|
85
|
+
'@codemirror/commands',
|
|
86
|
+
'@codemirror/language',
|
|
87
|
+
'@codemirror/lint',
|
|
88
|
+
'@codemirror/search',
|
|
89
|
+
'@codemirror/state',
|
|
90
|
+
'@codemirror/text',
|
|
91
|
+
'@codemirror/view',
|
|
92
|
+
'@lezer/common',
|
|
93
|
+
'@lezer/highlight',
|
|
94
|
+
'@lezer/lr',
|
|
95
|
+
'obsidian']
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = new Set([
|
|
99
|
+
'@codemirror/closebrackets',
|
|
100
|
+
'@codemirror/comment',
|
|
101
|
+
'@codemirror/fold',
|
|
102
|
+
'@codemirror/gutter',
|
|
103
|
+
'@codemirror/highlight',
|
|
104
|
+
'@codemirror/history',
|
|
105
|
+
'@codemirror/matchbrackets',
|
|
106
|
+
'@codemirror/panel',
|
|
107
|
+
'@codemirror/rangeset',
|
|
108
|
+
'@codemirror/rectangular-selection',
|
|
109
|
+
'@codemirror/stream-parser',
|
|
110
|
+
'@codemirror/tooltip']
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
function requirePatched(id) {
|
|
114
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
115
|
+
return originalRequire?.(id);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated, obsidianmd/no-global-this -- Need access to app. Actively use globalThis.
|
|
119
|
+
if (globalThis.app.isMobile) {
|
|
120
|
+
if (id === 'process' || id === 'node:process') {
|
|
121
|
+
// eslint-disable-next-line no-console -- Valid usage.
|
|
122
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
123
|
+
|
|
124
|
+
return process;
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
const module = originalRequire?.(id);
|
|
128
|
+
if (module) {
|
|
129
|
+
return extractDefault(module);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line no-console -- Valid usage.
|
|
134
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
138
|
+
|
|
139
|
+
"use strict";
|
|
140
|
+
var __defProp = Object.defineProperty;
|
|
141
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
142
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
143
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
144
|
+
var __export = (target, all) => {
|
|
145
|
+
for (var name in all)
|
|
146
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
147
|
+
};
|
|
148
|
+
var __copyProps = (to, from, except, desc) => {
|
|
149
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
150
|
+
for (let key of __getOwnPropNames(from))
|
|
151
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
152
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
153
|
+
}
|
|
154
|
+
return to;
|
|
155
|
+
};
|
|
156
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
157
|
+
var stale_build_global_setup_exports = {};
|
|
158
|
+
__export(stale_build_global_setup_exports, {
|
|
159
|
+
findStaleBuild: () => findStaleBuild,
|
|
160
|
+
formatStaleBuildMessage: () => formatStaleBuildMessage,
|
|
161
|
+
setup: () => setup
|
|
162
|
+
});
|
|
163
|
+
module.exports = __toCommonJS(stale_build_global_setup_exports);
|
|
164
|
+
var import_path = require('@mnaoumov/typescript-lib/path');
|
|
165
|
+
var import_node_fs = require('node:fs');
|
|
166
|
+
var import_node_path = require('node:path');
|
|
167
|
+
var import_obsidian_plugin_repo_paths = require('../obsidian-plugin-repo-paths.cjs');
|
|
168
|
+
const BUILD_PATH = `${import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.DistBuild}/${import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.MainJs}`;
|
|
169
|
+
const ROOT_BUILD_INPUTS = [import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.ManifestJson, import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.StylesCss];
|
|
170
|
+
const TEST_FILE_SUFFIX = import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.AnyTestTs.slice(1);
|
|
171
|
+
function findStaleBuild(params) {
|
|
172
|
+
const buildPath = (0, import_node_path.join)(params.rootFolder, BUILD_PATH);
|
|
173
|
+
if (!(0, import_node_fs.existsSync)(buildPath)) {
|
|
174
|
+
return { kind: "missing" };
|
|
175
|
+
}
|
|
176
|
+
const buildModifiedAt = (0, import_node_fs.statSync)(buildPath).mtime;
|
|
177
|
+
let newestInputPath = null;
|
|
178
|
+
let newestInputModifiedAt = buildModifiedAt;
|
|
179
|
+
for (const inputPath of getBuildInputPaths(params.rootFolder)) {
|
|
180
|
+
const modifiedAt = (0, import_node_fs.statSync)(inputPath).mtime;
|
|
181
|
+
if (modifiedAt <= newestInputModifiedAt) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
newestInputPath = inputPath;
|
|
185
|
+
newestInputModifiedAt = modifiedAt;
|
|
186
|
+
}
|
|
187
|
+
if (newestInputPath === null) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
buildModifiedAt,
|
|
192
|
+
kind: "outdated",
|
|
193
|
+
newestInputModifiedAt,
|
|
194
|
+
newestInputPath: (0, import_path.toPosixPath)((0, import_node_path.relative)(params.rootFolder, newestInputPath))
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function formatStaleBuildMessage(staleBuild) {
|
|
198
|
+
return staleBuild.kind === "missing" ? `${BUILD_PATH} does not exist, so there is no plugin for the integration tests to load. Run \`npm run build\` first.` : `${BUILD_PATH} is older than ${staleBuild.newestInputPath} (built ${staleBuild.buildModifiedAt.toISOString()}, changed ${staleBuild.newestInputModifiedAt.toISOString()}), so the integration tests would run the previous build instead of the current source. Run \`npm run build\` first.`;
|
|
199
|
+
}
|
|
200
|
+
function setup(project) {
|
|
201
|
+
const staleBuild = findStaleBuild({ rootFolder: project.config.root });
|
|
202
|
+
if (staleBuild !== null) {
|
|
203
|
+
throw new Error(formatStaleBuildMessage(staleBuild));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function getBuildInputPaths(rootFolder) {
|
|
207
|
+
const paths = ROOT_BUILD_INPUTS.map((rootInput) => (0, import_node_path.join)(rootFolder, rootInput)).filter((path) => (0, import_node_fs.existsSync)(path));
|
|
208
|
+
const srcFolder = (0, import_node_path.join)(rootFolder, import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.Src);
|
|
209
|
+
if (!(0, import_node_fs.existsSync)(srcFolder)) {
|
|
210
|
+
return paths;
|
|
211
|
+
}
|
|
212
|
+
const testHelpersFolderPrefix = (0, import_node_path.join)(rootFolder, import_obsidian_plugin_repo_paths.ObsidianPluginRepoPaths.Mocks) + import_node_path.sep;
|
|
213
|
+
for (const entry of (0, import_node_fs.readdirSync)(srcFolder, { recursive: true, withFileTypes: true })) {
|
|
214
|
+
if (!entry.isFile() || entry.name.endsWith(TEST_FILE_SUFFIX)) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const path = (0, import_node_path.join)(entry.parentPath, entry.name);
|
|
218
|
+
if (!path.startsWith(testHelpersFolderPrefix)) {
|
|
219
|
+
paths.push(path);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return paths;
|
|
223
|
+
}
|
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
225
|
+
0 && (module.exports = {
|
|
226
|
+
findStaleBuild,
|
|
227
|
+
formatStaleBuildMessage,
|
|
228
|
+
setup
|
|
229
|
+
});
|
|
230
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL3Rlc3QtcnVubmVycy9zdGFsZS1idWlsZC1nbG9iYWwtc2V0dXAudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGZpbGVcbiAqXG4gKiBWaXRlc3QgZ2xvYmFsIHNldHVwIHRoYXQgcmVmdXNlcyB0byBzdGFydCBhbiBpbnRlZ3JhdGlvbiBwcm9qZWN0IHdob3NlIHBsdWdpbiBidWlsZCBpcyBzdGFsZS5cbiAqXG4gKiBUa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Sx1QkFBSyxZQUFZLDBEQUF3QixHQUFHO0FBQzlELE1BQUksS0FBQywyQkFBVyxTQUFTLEdBQUc7QUFDMUIsV0FBTztBQUFBLEVBQ1Q7QUFFQSxRQUFNLDhCQUEwQix1QkFBSyxZQUFZLDBEQUF3QixLQUFLLElBQUk7QUFDbEYsYUFBVyxhQUFTLDRCQUFZLFdBQVcsRUFBRSxXQUFXLE1BQU0sZUFBZSxLQUFLLENBQUMsR0FBRztBQUNwRixRQUFJLENBQUMsTUFBTSxPQUFPLEtBQUssTUFBTSxLQUFLLFNBQVMsZ0JBQWdCLEdBQUc7QUFDNUQ7QUFBQSxJQUNGO0FBRUEsVUFBTSxXQUFPLHVCQUFLLE1BQU0sWUFBWSxNQUFNLElBQUk7QUFDOUMsUUFBSSxDQUFDLEtBQUssV0FBVyx1QkFBdUIsR0FBRztBQUM3QyxZQUFNLEtBQUssSUFBSTtBQUFBLElBQ2pCO0FBQUEsRUFDRjtBQUVBLFNBQU87QUFDVDsiLAogICJuYW1lcyI6IFtdCn0K
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/// <reference path="../index.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Vitest global setup that refuses to start an integration project whose plugin build is stale.
|
|
6
|
+
*
|
|
7
|
+
* The integration harness enables the plugin from its BUILD, `dist/build/main.js`, and a plugin's
|
|
8
|
+
* `test:integration*` scripts call vitest directly, so nothing on that path builds first. A session that
|
|
9
|
+
* edits `src/` and then runs one integration project tests the last build, however old it is, and the
|
|
10
|
+
* suite reports the old code as a behavior difference, not as a stale artifact. One such run cost a CDP
|
|
11
|
+
* probe into Obsidian's own link resolution, a wrong cache-race theory, and a harness change that was
|
|
12
|
+
* made and then reverted before anyone noticed that the build was three days old. `npm run gate` avoided
|
|
13
|
+
* the problem only because it happens to build before it runs `test:integration`.
|
|
14
|
+
*
|
|
15
|
+
* The setup refuses to start rather than building. A build inside a global setup would run once per
|
|
16
|
+
* project in a multi-project aggregate, and it would slow down a deliberate re-run of an unchanged build.
|
|
17
|
+
* A refusal is cheap, and it says what to run.
|
|
18
|
+
*
|
|
19
|
+
* Test files are not build inputs. Editing an integration case and re-running it is exactly the loop that
|
|
20
|
+
* must not force a rebuild, so `*.test.ts` files and `src/test-helpers/` are ignored. A dependency bump
|
|
21
|
+
* is not detected either: only files in the repo are compared, not `node_modules`.
|
|
22
|
+
*/
|
|
23
|
+
import type { TestProject } from 'vitest/node' with { 'resolution-mode': 'import' };
|
|
24
|
+
/**
|
|
25
|
+
* Parameters for {@link findStaleBuild}.
|
|
26
|
+
*/
|
|
27
|
+
export interface FindStaleBuildParams {
|
|
28
|
+
/**
|
|
29
|
+
* The root folder of the plugin repo.
|
|
30
|
+
*/
|
|
31
|
+
readonly rootFolder: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The build does not exist at all.
|
|
35
|
+
*/
|
|
36
|
+
export interface MissingBuild {
|
|
37
|
+
/**
|
|
38
|
+
* The discriminant.
|
|
39
|
+
*/
|
|
40
|
+
readonly kind: 'missing';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The build exists but is older than one of its inputs.
|
|
44
|
+
*/
|
|
45
|
+
export interface OutdatedBuild {
|
|
46
|
+
/**
|
|
47
|
+
* The modification time of `dist/build/main.js`.
|
|
48
|
+
*/
|
|
49
|
+
readonly buildModifiedAt: Date;
|
|
50
|
+
/**
|
|
51
|
+
* The discriminant.
|
|
52
|
+
*/
|
|
53
|
+
readonly kind: 'outdated';
|
|
54
|
+
/**
|
|
55
|
+
* The modification time of {@link OutdatedBuild.newestInputPath}.
|
|
56
|
+
*/
|
|
57
|
+
readonly newestInputModifiedAt: Date;
|
|
58
|
+
/**
|
|
59
|
+
* The newest build input, relative to the root folder.
|
|
60
|
+
*/
|
|
61
|
+
readonly newestInputPath: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Why the build cannot be tested, as returned by {@link findStaleBuild}.
|
|
65
|
+
*/
|
|
66
|
+
export type StaleBuild = MissingBuild | OutdatedBuild;
|
|
67
|
+
/**
|
|
68
|
+
* Checks whether `dist/build/main.js` is missing, or older than one of the files it is built from.
|
|
69
|
+
*
|
|
70
|
+
* @param params - The parameters.
|
|
71
|
+
* @returns `null` when the build is current; otherwise a description of the problem.
|
|
72
|
+
*/
|
|
73
|
+
export declare function findStaleBuild(params: FindStaleBuildParams): null | StaleBuild;
|
|
74
|
+
/**
|
|
75
|
+
* Formats a {@link StaleBuild} as the message the setup throws.
|
|
76
|
+
*
|
|
77
|
+
* @param staleBuild - The stale build.
|
|
78
|
+
* @returns The message.
|
|
79
|
+
*/
|
|
80
|
+
export declare function formatStaleBuildMessage(staleBuild: StaleBuild): string;
|
|
81
|
+
/**
|
|
82
|
+
* Vitest global setup: throws when the plugin build is missing or stale.
|
|
83
|
+
*
|
|
84
|
+
* @param project - The Vitest test project.
|
|
85
|
+
*/
|
|
86
|
+
export declare function setup(project: TestProject): void;
|