Skip to content

Commit

Permalink
fix: duplicated builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Jun 6, 2022
1 parent 1e99e25 commit c019fd4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
13 changes: 1 addition & 12 deletions packages/bytemd/build.mjs → packages/bytemd/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@ import { preprocess } from 'svelte/compiler'
import glob from 'fast-glob'
import { build } from 'vite'
import { resolveModule } from 'local-pkg'
import sveltePreprocess from 'svelte-preprocess'

export const sveltePreprocessor = sveltePreprocess({
typescript: true,
// https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198
replace: [
[/(>)[\s]*([<{])/g, '$1$2'],
[/({[/:][a-z]+})[\s]*([<{])/g, '$1$2'],
[/({[#:][a-z]+ .+?})[\s]*([<{])/g, '$1$2'],
[/([>}])[\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],
],
})
import { sveltePreprocessor } from './utils.mjs'

const pkgName = 'decode-named-character-reference'
const resolveOptions = {
Expand Down
13 changes: 13 additions & 0 deletions packages/bytemd/scripts/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check
import sveltePreprocess from 'svelte-preprocess'

export const sveltePreprocessor = sveltePreprocess({
typescript: true,
// https://github.com/sveltejs/svelte/issues/189#issuecomment-586142198
replace: [
[/(>)[\s]*([<{])/g, '$1$2'],
[/({[/:][a-z]+})[\s]*([<{])/g, '$1$2'],
[/({[#:][a-z]+ .+?})[\s]*([<{])/g, '$1$2'],
[/([>}])[\s]+(<|{[/#:][a-z][^}]*})/g, '$1$2'],
],
})
2 changes: 1 addition & 1 deletion packages/bytemd/tsdv.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import { defineConfig } from 'tsdv'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { sveltePreprocessor } from './build.mjs'
import { sveltePreprocessor } from './scripts/utils.mjs'

// nullish coalescing in es2020
// TODO: 'decode-named-character-reference'
Expand Down

0 comments on commit c019fd4

Please sign in to comment.