-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build for the
esm
, cjs
, and umd
formats
- Loading branch information
Showing
14 changed files
with
310 additions
and
366 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,28 @@ | ||
/// <reference types="vitest" /> | ||
import { resolve } from 'node:path' | ||
import { defineConfig, type BuildOptions } from 'vite' | ||
import { defineConfig } from 'vite' | ||
import cacheDir from 'vite-plugin-cachedir' | ||
|
||
export default defineConfig(({ command, ssrBuild }) => { | ||
const isBuildLib = command === 'build' && !ssrBuild | ||
const build: BuildOptions = {} | ||
|
||
if (isBuildLib) { | ||
Object.assign(build, { | ||
emptyOutDir: false, | ||
lib: { | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
name: 'markedCodeFormat', | ||
formats: ['umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked', 'prettier'], | ||
output: { | ||
globals: { | ||
marked: 'marked', | ||
prettier: 'prettier' | ||
} | ||
export default defineConfig({ | ||
plugins: [cacheDir()], | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
name: 'markedCodeFormat', | ||
formats: ['es', 'cjs', 'umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked', 'prettier'], | ||
output: { | ||
globals: { | ||
marked: 'marked', | ||
prettier: 'prettier' | ||
} | ||
} | ||
}) | ||
} | ||
|
||
return { | ||
plugins: [cacheDir()], | ||
build, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,25 @@ | ||
/// <reference types="vitest" /> | ||
import { resolve } from 'node:path' | ||
import { defineConfig, type BuildOptions } from 'vite' | ||
import { defineConfig } from 'vite' | ||
import cacheDir from 'vite-plugin-cachedir' | ||
|
||
export default defineConfig(({ command, ssrBuild }) => { | ||
const isBuildLib = command === 'build' && !ssrBuild | ||
const build: BuildOptions = {} | ||
|
||
if (isBuildLib) { | ||
Object.assign(build, { | ||
emptyOutDir: false, | ||
lib: { | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
name: 'markedCodePreview', | ||
formats: ['umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked'], | ||
output: { globals: { marked: 'marked' } } | ||
} | ||
}) | ||
} | ||
|
||
return { | ||
plugins: [cacheDir()], | ||
ssr: { | ||
noExternal: ['pupa', 'escape-goat', 'moo'] | ||
export default defineConfig({ | ||
plugins: [cacheDir()], | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
name: 'markedCodePreview', | ||
formats: ['es', 'cjs', 'umd'], | ||
fileName: 'index' | ||
}, | ||
build, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
rollupOptions: { | ||
external: ['marked', 'attributes-parser'], | ||
output: { | ||
globals: { marked: 'marked', 'attributes-parser': 'parseAttrs' } | ||
} | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
/// <reference types="vitest" /> | ||
import { resolve } from 'node:path' | ||
import { defineConfig, type BuildOptions } from 'vite' | ||
import { defineConfig } from 'vite' | ||
import cacheDir from 'vite-plugin-cachedir' | ||
|
||
export default defineConfig(({ command, ssrBuild }) => { | ||
const isBuildLib = command === 'build' && !ssrBuild | ||
const build: BuildOptions = {} | ||
|
||
if (isBuildLib) { | ||
Object.assign(build, { | ||
emptyOutDir: false, | ||
lib: { | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
name: 'markedFootnote', | ||
formats: ['umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked'] | ||
} | ||
}) | ||
} | ||
|
||
return { | ||
plugins: [cacheDir()], | ||
build, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
export default defineConfig({ | ||
plugins: [cacheDir()], | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
name: 'markedFootnote', | ||
formats: ['es', 'cjs', 'umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked'] | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,30 @@ | ||
/// <reference types="vitest" /> | ||
import { resolve } from 'node:path' | ||
import { defineConfig, type BuildOptions } from 'vite' | ||
import { defineConfig } from 'vite' | ||
import cacheDir from 'vite-plugin-cachedir' | ||
|
||
export default defineConfig(({ command, ssrBuild }) => { | ||
const isBuildLib = command === 'build' && !ssrBuild | ||
const build: BuildOptions = {} | ||
|
||
if (isBuildLib) { | ||
Object.assign(build, { | ||
emptyOutDir: false, | ||
lib: { | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
name: 'markedHookData', | ||
formats: ['umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked', 'fast-glob', 'loadee', 'node:path'], | ||
output: { | ||
globals: { | ||
marked: 'marked', | ||
'fast-glob': 'fg', | ||
loadee: 'loadee', | ||
'node:path': 'path' | ||
} | ||
export default defineConfig({ | ||
plugins: [cacheDir()], | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
name: 'markedHookData', | ||
formats: ['es', 'cjs', 'umd'], | ||
fileName: 'index' | ||
}, | ||
rollupOptions: { | ||
external: ['marked', 'fast-glob', 'loadee', 'node:path'], | ||
output: { | ||
globals: { | ||
marked: 'marked', | ||
loadee: 'loadee', | ||
'fast-glob': 'fg', | ||
'node:path': 'path' | ||
} | ||
} | ||
}) | ||
} | ||
|
||
return { | ||
plugins: [cacheDir()], | ||
build, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
include: ['test/*.test.ts'] | ||
} | ||
}) |
Oops, something went wrong.