forked from BearToCode/mismerge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add built Custom Elements into the npm package
- Loading branch information
1 parent
8a5fc71
commit 8f13f8c
Showing
16 changed files
with
10,012 additions
and
10 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -12,3 +12,6 @@ package | |
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Vanilla build files | ||
vanilla.js |
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
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 |
---|---|---|
|
@@ -12,3 +12,6 @@ dist | |
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Vanilla build files | ||
vanilla.js |
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 |
---|---|---|
|
@@ -10,4 +10,6 @@ node_modules | |
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* | ||
.vscode | ||
.idea | ||
.idea | ||
vanilla.* | ||
/**/*.tgz |
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/// | ||
/// Rollup configuration for the vanilla build which can be reused for | ||
/// projects that don't use a framework like Svelte (i.e. Vue, React), or can be imported without the need of a bundler. | ||
/// | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import { getBabelOutputPlugin } from '@rollup/plugin-babel'; | ||
import path from 'path'; | ||
import svelte from 'rollup-plugin-svelte'; | ||
import terser from '@rollup/plugin-terser'; | ||
import sveltePreprocess from 'svelte-preprocess'; | ||
import alias from '@rollup/plugin-alias'; | ||
import copy from 'rollup-plugin-copy'; | ||
import { dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
const coreSourcePath = __dirname; | ||
const coreLibPath = path.join(coreSourcePath, 'src/lib'); | ||
|
||
const isProduction = !process.env.ROLLUP_WATCH; | ||
|
||
if (!isProduction) { | ||
throw new Error('This build is only for production'); | ||
} | ||
|
||
const outputFolder = path.join(__dirname); | ||
|
||
export default [ | ||
{ | ||
input: path.join(coreLibPath, 'index.ts'), | ||
output: [ | ||
{ | ||
file: path.join(outputFolder, '/vanilla.js'), | ||
format: 'es', | ||
sourcemap: true, | ||
inlineDynamicImports: true | ||
} | ||
], | ||
plugins: [ | ||
alias({ | ||
entries: [ | ||
{ | ||
find: '$lib', | ||
replacement: coreLibPath | ||
} | ||
] | ||
}), | ||
svelte({ | ||
preprocess: sveltePreprocess(), | ||
compilerOptions: { | ||
customElement: true | ||
} | ||
}), | ||
resolve({ | ||
browser: true, | ||
exportConditions: ['svelte'] | ||
}), | ||
typescript({ | ||
sourceMap: true, | ||
inlineSources: true, | ||
tsconfig: path.join(coreSourcePath, 'tsconfig.json'), | ||
include: [path.join(coreLibPath, '**/*')], | ||
// TODO: Add proper types for the bundle | ||
declaration: false | ||
}), | ||
getBabelOutputPlugin({ | ||
presets: ['@babel/preset-env'] | ||
}), | ||
copy({ | ||
targets: [ | ||
{ | ||
src: path.join(coreSourcePath, '/dist/index.d.ts'), | ||
dest: outputFolder, | ||
rename: 'vanilla.d.ts' | ||
} | ||
] | ||
}), | ||
terser() | ||
] | ||
} | ||
]; |
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
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
Oops, something went wrong.