-
-
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.
chore: migrate to
rolli
bundler (#2)
- Loading branch information
Showing
12 changed files
with
2,862 additions
and
2,428 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { defineConfig } from 'rolli' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
tsconfig: 'playground/.nuxt/tsconfig.json', | ||
exports: false, | ||
bin: false, | ||
entries: [ | ||
// Module Core | ||
{ | ||
input: './src/module.ts', | ||
output: './dist/module.mjs', | ||
externals: [/@nuxt/], | ||
replace: { | ||
preventAssignment: true, | ||
__name__: pkg.name, | ||
__version__: pkg.version, | ||
}, | ||
}, | ||
{ | ||
input: './src/types/module.ts', | ||
output: './dist/module.d.ts', | ||
}, | ||
// Runtime Composables | ||
{ | ||
input: './src/runtime/composables/index.ts', | ||
output: './dist/runtime/composables/index.mjs', | ||
externals: ['#imports'], | ||
}, | ||
{ | ||
input: './src/types/runtime/composables/index.ts', | ||
output: './dist/runtime/composables/index.d.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const name = '__name__' | ||
export const version = '__version__' | ||
export const configKey = 'font' | ||
export const compatibility = { | ||
nuxt: '>=3.0.0', | ||
} |
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 +1 @@ | ||
export * from './useFont' | ||
export * from './use-font' |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './use-font' |
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,63 @@ | ||
import { resolve } from 'node:path' | ||
import { writeFile } from 'node:fs/promises' | ||
import { configKey, compatibility } from '../meta' | ||
import { name, version } from '../../package.json' | ||
|
||
/** | ||
* Generates a `module.json` meta template. | ||
*/ | ||
export async function generateModuleMeta() { | ||
const root = process.cwd() | ||
|
||
const meta = { | ||
name, | ||
version, | ||
configKey, | ||
compatibility, | ||
} | ||
|
||
const metaPath = resolve(root, './dist/module.json') | ||
const metaTemplate = JSON.stringify(meta, null, 2) | ||
|
||
return await writeFile(metaPath, metaTemplate) | ||
} | ||
|
||
/** | ||
* Generates shims for `nuxt.config` auto-completion. | ||
*/ | ||
export async function generateModuleTypes() { | ||
const root = process.cwd() | ||
const typesPath = resolve(root, './dist/types.d.ts') | ||
|
||
const comment = `/** | ||
* Nuxt Font Module | ||
* | ||
* Auto-optimized font loader for Nuxt. | ||
* | ||
* @see [Repository](https://github.com/hypernym-studio/nuxt-font) | ||
*/` | ||
|
||
const typesTemplate = `import { ModuleOptions } from './module' | ||
declare module '@nuxt/schema' { | ||
interface NuxtConfig { | ||
${comment} | ||
['${configKey}']?: Partial<ModuleOptions> | ||
} | ||
interface NuxtOptions { | ||
${comment} | ||
['${configKey}']?: ModuleOptions | ||
} | ||
} | ||
declare module 'nuxt/schema' { | ||
interface NuxtConfig { ['${configKey}']?: Partial<ModuleOptions> } | ||
interface NuxtOptions { ['${configKey}']?: ModuleOptions } | ||
} | ||
export { ModuleOptions, default } from './module'` | ||
|
||
return await writeFile(typesPath, typesTemplate) | ||
} | ||
|
||
generateModuleMeta() | ||
generateModuleTypes() |