File tree Expand file tree Collapse file tree 12 files changed +169
-0
lines changed Expand file tree Collapse file tree 12 files changed +169
-0
lines changed Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ indent_size = 2
5+ indent_style = space
6+ end_of_line = lf
7+ charset = utf-8
8+ trim_trailing_whitespace = true
9+ insert_final_newline = true
10+
11+ [* .md ]
12+ trim_trailing_whitespace = false
Original file line number Diff line number Diff line change 1+ dist
2+ node_modules
Original file line number Diff line number Diff line change 1+ {
2+ "extends": [
3+ "@nuxtjs/eslint-config-typescript"
4+ ],
5+ "rules": {
6+ "@typescript-eslint/no-unused-vars": [
7+ "off"
8+ ]
9+ }
10+ }
Original file line number Diff line number Diff line change 1+ # Dependencies
2+ node_modules
3+
4+ # Logs
5+ * .log *
6+
7+ # Temp directories
8+ .temp
9+ .tmp
10+ .cache
11+
12+ # Yarn
13+ ** /.yarn /cache
14+ ** /.yarn /* state *
15+
16+ # Generated dirs
17+ dist
18+
19+ # Nuxt
20+ .nuxt
21+ .output
22+ .vercel_build_output
23+ .build- *
24+ .env
25+ .netlify
26+
27+ # Env
28+ .env
29+
30+ # Testing
31+ reports
32+ coverage
33+ * .lcov
34+ .nyc_output
35+
36+ # VSCode
37+ .vscode
38+
39+ # Intellij idea
40+ * .iml
41+ .idea
42+
43+ # OSX
44+ .DS_Store
45+ .AppleDouble
46+ .LSOverride
47+ .AppleDB
48+ .AppleDesktop
49+ Network Trash Folder
50+ Temporary Items
51+ .apdisk
Original file line number Diff line number Diff line change 1+ # Nuxt Module
2+
3+ ## Development
4+
5+ - Run ` npm run dev:prepare ` to generate type stubs.
6+ - Use ` npm run dev ` to start [ playground] ( ./playground ) in development mode.
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " my-module" ,
3+ "version" : " 1.0.0" ,
4+ "license" : " MIT" ,
5+ "type" : " module" ,
6+ "exports" : {
7+ "." : {
8+ "import" : " ./dist/module.mjs" ,
9+ "require" : " ./dist/module.cjs"
10+ }
11+ },
12+ "main" : " ./dist/module.cjs" ,
13+ "types" : " ./dist/types.d.ts" ,
14+ "files" : [
15+ " dist"
16+ ],
17+ "scripts" : {
18+ "prepack" : " nuxt-module-build" ,
19+ "dev" : " nuxi dev playground" ,
20+ "dev:build" : " nuxi build playground" ,
21+ "dev:prepare" : " nuxt-module-build --stub && nuxi prepare playground"
22+ },
23+ "dependencies" : {
24+ "@nuxt/kit" : " ^3.0.0-rc.12"
25+ },
26+ "devDependencies" : {
27+ "@nuxt/module-builder" : " ^0.2.0" ,
28+ "@nuxt/schema" : " ^3.0.0-rc.12" ,
29+ "@nuxtjs/eslint-config-typescript" : " ^11.0.0" ,
30+ "eslint" : " ^8.26.0" ,
31+ "nuxt" : " ^3.0.0-rc.12"
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ Nuxt module playground!
4+ </div >
5+ </template >
6+
7+ <script setup>
8+ </script >
Original file line number Diff line number Diff line change 1+ import { defineNuxtConfig } from 'nuxt/config'
2+ import MyModule from '..'
3+
4+ export default defineNuxtConfig ( {
5+ modules : [
6+ MyModule
7+ ] ,
8+ myModule : {
9+ addPlugin : true
10+ }
11+ } )
Original file line number Diff line number Diff line change 1+ {
2+ "private" : true ,
3+ "name" : " my-module-playground"
4+ }
Original file line number Diff line number Diff line change 1+ import { resolve } from 'path'
2+ import { fileURLToPath } from 'url'
3+ import { defineNuxtModule , addPlugin } from '@nuxt/kit'
4+
5+ export interface ModuleOptions {
6+ addPlugin : boolean
7+ }
8+
9+ export default defineNuxtModule < ModuleOptions > ( {
10+ meta : {
11+ name : 'my-module' ,
12+ configKey : 'myModule'
13+ } ,
14+ defaults : {
15+ addPlugin : true
16+ } ,
17+ setup ( options , nuxt ) {
18+ if ( options . addPlugin ) {
19+ const runtimeDir = fileURLToPath ( new URL ( './runtime' , import . meta. url ) )
20+ nuxt . options . build . transpile . push ( runtimeDir )
21+ addPlugin ( resolve ( runtimeDir , 'plugin' ) )
22+ }
23+ }
24+ } )
You can’t perform that action at this time.
0 commit comments