@evidence-dev/preprocess
Advanced tools
+6
-0
| # @evidence-dev/preprocess | ||
| ## 5.0.0 | ||
| ### Major Changes | ||
| - d60fdad7: Convert preprocess to use Query from sdk | ||
| ## 4.1.2 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@evidence-dev/preprocess", | ||
| "version": "4.1.2", | ||
| "version": "5.0.0", | ||
| "description": "Markdown preprocessor for evidence.dev projects", | ||
@@ -5,0 +5,0 @@ "author": "evidence.dev", |
+35
-31
@@ -33,3 +33,3 @@ const { getRouteHash } = require('./utils/get-route-hash.cjs'); | ||
| const errQueries = Object.values(duckdbQueries).filter(q => q.compileError).map(q => `const ${q.id} = QueryStore.create(\`${q.compiledQueryString.replaceAll("$", "\\$")}\`, undefined, "${q.id}", { initialError: new Error(\`${q.compileError.replaceAll("$", "\\$")}\`)})`) | ||
| const errQueries = Object.values(duckdbQueries).filter(q => q.compileError).map(q => `const ${q.id} = Query.create(\`${q.compiledQueryString.replaceAll("$", "\\$")}\`, undefined, { id: "${q.id}", initialError: new Error(\`${q.compileError.replaceAll("$", "\\$")}\`)})`) | ||
@@ -104,3 +104,3 @@ | ||
| try { | ||
| if (_${id}_changed || __has_hmr_run) { | ||
| if (_${id}_changed || import.meta.hot?.data.hmrHasRun) { | ||
| // Query changed after page load, we have no prerendered results | ||
@@ -116,3 +116,3 @@ initialData = undefined | ||
| } | ||
| } else { | ||
| } else if (!browser) { | ||
| // We are currently prerendering | ||
@@ -130,7 +130,7 @@ initialData = profile(__db.query, _${id}_query_text, { query_name: '${id}' }) | ||
| const query_store = QueryStore.create( | ||
| const query_store = Query.create( | ||
| _${id}_query_text, | ||
| queryFunc, | ||
| '${id}', | ||
| { | ||
| id: '${id}', | ||
| scoreNotifier, | ||
@@ -218,7 +218,6 @@ initialData, | ||
| ${input_ids.map((id) => ` | ||
| ${id} = get(QueryStore.create( | ||
| ${id} = get(Query.create( | ||
| \`${duckdbQueries[id].compiledQueryString.replaceAll('`', '\\`')}\`, | ||
| queryFunc, | ||
| '${id}', | ||
| {} | ||
| { id: '${id}' } | ||
| )); | ||
@@ -277,7 +276,7 @@ `).join('\n')} | ||
| import debounce from 'debounce'; | ||
| import { QueryStore } from '@evidence-dev/query-store'; | ||
| import { Query } from '@evidence-dev/sdk/usql'; | ||
| import { setQueryFunction } from '@evidence-dev/component-utilities/buildQuery'; | ||
| if (!browser) { | ||
| onDestroy(() => QueryStore.emptyCache()); | ||
| onDestroy(() => Query.emptyCache()); | ||
| } | ||
@@ -299,25 +298,30 @@ | ||
| const activeQueries = QueryStore.activeQueries; | ||
| let loadingQueriesToast = 0; | ||
| $: if ($activeQueries.size > 0) { | ||
| clearTimeout(loadingQueriesToast); | ||
| loadingQueriesToast = setTimeout(() => { | ||
| toasts.add({ | ||
| id: 'LoadingToast', | ||
| title: '', | ||
| message: 'Loading...', | ||
| status: 'info' | ||
| }, 2 ** 31 - 1); | ||
| }, 1000); | ||
| } else { | ||
| clearTimeout(loadingQueriesToast); | ||
| toasts.dismiss('LoadingToast'); | ||
| const onInflightQueriesStart = () => { | ||
| toasts.add({ | ||
| id: 'LoadingToast', | ||
| title: '', | ||
| message: 'Loading...', | ||
| status: 'info' | ||
| }, 0); // timeout of 0 means forever | ||
| } | ||
| const onInflightQueriesEnd = () => { | ||
| toasts.dismiss('LoadingToast') | ||
| } | ||
| onMount(() => { | ||
| Query.addEventListener('inFlightQueryStart', onInflightQueriesStart) | ||
| Query.addEventListener('inFlightQueryEnd', onInflightQueriesEnd) | ||
| if (Query.QueriesLoading) { | ||
| onInflightQueriesStart() | ||
| } | ||
| return () => { | ||
| Query.removeEventListener('inFlightQueryStart', onInflightQueriesStart) | ||
| Query.removeEventListener('inFlightQueryEnd', onInflightQueriesEnd) | ||
| } | ||
| }) | ||
| let __has_hmr_run = false | ||
| if (import.meta?.hot) { | ||
| import.meta.hot.on("vite:afterUpdate", () => { | ||
| __has_hmr_run = true | ||
| QueryStore.emptyCache() // All bets are off | ||
| if (import.meta?.hot) { | ||
| if (typeof import.meta.hot.data.hmrHasRun === 'undefined') import.meta.hot.data.hmrHasRun = false | ||
| import.meta.hot.on("vite:beforeUpdate", () => { | ||
| import.meta.hot.data.hmrHasRun = true | ||
| Query.emptyCache() // All bets are off | ||
| }) | ||
@@ -324,0 +328,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
4077458
0.04%95963
0.02%