@platformatic/nuxt 0.0.1 → 3.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +26 -0
- package/config.d.ts +749 -0
- package/eslint.config.js +3 -0
- package/index.d.ts +35 -0
- package/index.js +31 -0
- package/lib/capability.js +255 -0
- package/lib/schema.js +50 -0
- package/package.json +39 -18
- package/schema.json +2805 -0
- package/test/backlog.test.js +88 -0
- package/test/development.test.js +216 -0
- package/test/fetch.test.js +67 -0
- package/test/fixtures/composer-autodetect-prefix/package.json +10 -0
- package/test/fixtures/composer-autodetect-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/composer-custom-commands/package.json +11 -0
- package/test/fixtures/composer-custom-commands/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-custom-commands/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-custom-commands/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-custom-commands/services/frontend/package.json +16 -0
- package/test/fixtures/composer-custom-commands/services/frontend/platformatic.application.json +11 -0
- package/test/fixtures/composer-with-prefix/package.json +10 -0
- package/test/fixtures/composer-with-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-with-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-with-prefix/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-with-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-with-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/composer-without-prefix/package.json +10 -0
- package/test/fixtures/composer-without-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-without-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-without-prefix/services/frontend/nuxt.config.js +13 -0
- package/test/fixtures/composer-without-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-without-prefix/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/fetch-test/package.json +10 -0
- package/test/fixtures/fetch-test/platformatic.runtime.json +24 -0
- package/test/fixtures/fetch-test/services/frontend/app.vue +29 -0
- package/test/fixtures/fetch-test/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/fetch-test/services/frontend/package.json +9 -0
- package/test/fixtures/fetch-test/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/logger/package.json +8 -0
- package/test/fixtures/logger/platformatic.runtime.json +15 -0
- package/test/fixtures/logger/services/frontend/app.vue +12 -0
- package/test/fixtures/logger/services/frontend/logger-formatters.js +7 -0
- package/test/fixtures/logger/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/logger/services/frontend/package.json +9 -0
- package/test/fixtures/logger/services/frontend/platformatic.application.json +14 -0
- package/test/fixtures/metrics/package.json +10 -0
- package/test/fixtures/metrics/platformatic.runtime.json +25 -0
- package/test/fixtures/metrics/services/backend/package.json +6 -0
- package/test/fixtures/metrics/services/backend/platformatic.json +16 -0
- package/test/fixtures/metrics/services/backend/plugins/example.js +3 -0
- package/test/fixtures/metrics/services/backend/routes/root.js +30 -0
- package/test/fixtures/metrics/services/composer/package.json +6 -0
- package/test/fixtures/metrics/services/composer/platformatic.json +14 -0
- package/test/fixtures/metrics/services/frontend/app.vue +8 -0
- package/test/fixtures/metrics/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/metrics/services/frontend/package.json +9 -0
- package/test/fixtures/metrics/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-autodetect-prefix/package.json +10 -0
- package/test/fixtures/ssr-autodetect-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-custom-commands/package.json +11 -0
- package/test/fixtures/ssr-custom-commands/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/package.json +16 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/platformatic.application.json +11 -0
- package/test/fixtures/ssr-standalone/package.json +8 -0
- package/test/fixtures/ssr-standalone/platformatic.runtime.json +15 -0
- package/test/fixtures/ssr-standalone/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-standalone/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/ssr-standalone/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-standalone/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/ssr-with-prefix/package.json +10 -0
- package/test/fixtures/ssr-with-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-without-prefix/package.json +10 -0
- package/test/fixtures/ssr-without-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/standalone/package.json +8 -0
- package/test/fixtures/standalone/platformatic.runtime.json +15 -0
- package/test/fixtures/standalone/services/frontend/app.vue +8 -0
- package/test/fixtures/standalone/services/frontend/nuxt.config.js +13 -0
- package/test/fixtures/standalone/services/frontend/package.json +9 -0
- package/test/fixtures/standalone/services/frontend/platformatic.application.json +3 -0
- package/test/helper.js +1 -0
- package/test/https.test.js +43 -0
- package/test/logger.test.js +31 -0
- package/test/metrics.test.js +46 -0
- package/test/miscellaneous.test.js +33 -0
- package/test/production.test.js +153 -0
- package/test/types/index.tst.ts +34 -0
- package/test/version-check.test.js +29 -0
package/eslint.config.js
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseCapability, BaseContext, BaseOptions } from '@platformatic/basic'
|
|
2
|
+
import { Configuration, ConfigurationOptions } from '@platformatic/foundation'
|
|
3
|
+
import { JSONSchemaType } from 'ajv'
|
|
4
|
+
import type { PlatformaticNuxtConfig } from './config.d.ts'
|
|
5
|
+
|
|
6
|
+
export type { PlatformaticNuxtConfig } from './config.d.ts'
|
|
7
|
+
|
|
8
|
+
export interface NuxtContext extends BaseContext {}
|
|
9
|
+
|
|
10
|
+
export type NuxtConfiguration = Configuration<PlatformaticNuxtConfig>
|
|
11
|
+
|
|
12
|
+
export declare function loadConfiguration (
|
|
13
|
+
root: string | PlatformaticNuxtConfig,
|
|
14
|
+
source?: string | PlatformaticNuxtConfig,
|
|
15
|
+
context?: ConfigurationOptions
|
|
16
|
+
): Promise<NuxtConfiguration>
|
|
17
|
+
|
|
18
|
+
export declare function create (
|
|
19
|
+
configOrRoot: string | PlatformaticNuxtConfig,
|
|
20
|
+
sourceOrConfig?: string | PlatformaticNuxtConfig,
|
|
21
|
+
context?: ConfigurationOptions
|
|
22
|
+
): Promise<NuxtCapability>
|
|
23
|
+
|
|
24
|
+
export declare class NuxtCapability extends BaseCapability<
|
|
25
|
+
PlatformaticNuxtConfig,
|
|
26
|
+
BaseOptions<NuxtContext>
|
|
27
|
+
> {
|
|
28
|
+
constructor (root: string, config: PlatformaticNuxtConfig, context?: object)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare const packageJson: Record<string, unknown>
|
|
32
|
+
export declare const schema: JSONSchemaType<PlatformaticNuxtConfig>
|
|
33
|
+
export declare const schemaComponents: { nuxt: unknown }
|
|
34
|
+
export declare const version: string
|
|
35
|
+
export declare const supportedVersions: string
|
package/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { transform as basicTransform, resolve, validationOptions } from '@platformatic/basic'
|
|
2
|
+
import { kMetadata, loadConfiguration as utilsLoadConfiguration } from '@platformatic/foundation'
|
|
3
|
+
import { NuxtCapability } from './lib/capability.js'
|
|
4
|
+
import { schema } from './lib/schema.js'
|
|
5
|
+
|
|
6
|
+
/* c8 ignore next 5 */
|
|
7
|
+
export async function transform (config, schema, options) {
|
|
8
|
+
config = await basicTransform(config, schema, options)
|
|
9
|
+
config.watch = { enabled: false }
|
|
10
|
+
return config
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function loadConfiguration (configOrRoot, sourceOrConfig, context) {
|
|
14
|
+
const { root, source } = await resolve(configOrRoot, sourceOrConfig, 'application')
|
|
15
|
+
|
|
16
|
+
return utilsLoadConfiguration(source, context?.schema ?? schema, {
|
|
17
|
+
validationOptions,
|
|
18
|
+
transform,
|
|
19
|
+
replaceEnv: true,
|
|
20
|
+
root,
|
|
21
|
+
...context
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function create (configOrRoot, sourceOrConfig, context) {
|
|
26
|
+
const config = await loadConfiguration(configOrRoot, sourceOrConfig, context)
|
|
27
|
+
return new NuxtCapability(config[kMetadata].root, config, context)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export * from './lib/capability.js'
|
|
31
|
+
export { packageJson, schema, schemaComponents, version } from './lib/schema.js'
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseCapability,
|
|
3
|
+
buildAdditionalServerOptions,
|
|
4
|
+
cleanBasePath,
|
|
5
|
+
createServerListener,
|
|
6
|
+
ensureTrailingSlash,
|
|
7
|
+
errors,
|
|
8
|
+
getServerUrl,
|
|
9
|
+
importFile,
|
|
10
|
+
injectViaRequest,
|
|
11
|
+
resolvePackageViaESM,
|
|
12
|
+
} from '@platformatic/basic'
|
|
13
|
+
import {
|
|
14
|
+
sanitizeHTTPSArgument,
|
|
15
|
+
sanitizeHTTPSOptions,
|
|
16
|
+
} from '@platformatic/foundation'
|
|
17
|
+
import inject from 'light-my-request'
|
|
18
|
+
import { readFile } from 'node:fs/promises'
|
|
19
|
+
import { dirname, resolve } from 'node:path'
|
|
20
|
+
import { satisfies } from 'semver'
|
|
21
|
+
import { version } from './schema.js'
|
|
22
|
+
|
|
23
|
+
export const supportedVersions = '^4.0.0'
|
|
24
|
+
|
|
25
|
+
export class NuxtCapability extends BaseCapability {
|
|
26
|
+
#nuxt
|
|
27
|
+
#basePath
|
|
28
|
+
#server
|
|
29
|
+
#dispatcher
|
|
30
|
+
|
|
31
|
+
constructor (root, config, context) {
|
|
32
|
+
super('nuxt', version, root, config, context)
|
|
33
|
+
this.exitOnUnhandledErrors = false
|
|
34
|
+
this.subprocessTerminationSignal = 'SIGKILL'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async init () {
|
|
38
|
+
await super.init()
|
|
39
|
+
|
|
40
|
+
if (!this.isProduction) {
|
|
41
|
+
this.#nuxt = resolve(
|
|
42
|
+
dirname(await resolvePackageViaESM(this.root, 'nuxt')),
|
|
43
|
+
'..'
|
|
44
|
+
)
|
|
45
|
+
const nuxtPackage = JSON.parse(
|
|
46
|
+
await readFile(resolve(this.#nuxt, 'package.json'), 'utf-8')
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
if (!satisfies(nuxtPackage.version, supportedVersions)) {
|
|
50
|
+
throw new errors.UnsupportedVersion(
|
|
51
|
+
'nuxt',
|
|
52
|
+
nuxtPackage.version,
|
|
53
|
+
supportedVersions
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.#basePath = this.config.application?.basePath
|
|
59
|
+
? ensureTrailingSlash(cleanBasePath(this.config.application.basePath))
|
|
60
|
+
: undefined
|
|
61
|
+
|
|
62
|
+
this.registerGlobals({ basePath: this.#basePath })
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async start ({ listen }) {
|
|
66
|
+
// Make this idempotent
|
|
67
|
+
/* c8 ignore next 3 */
|
|
68
|
+
if (this.url) {
|
|
69
|
+
return this.url
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
await super._start({ listen })
|
|
73
|
+
|
|
74
|
+
const command =
|
|
75
|
+
this.config.application.commands[
|
|
76
|
+
this.isProduction ? 'production' : 'development'
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
if (command) {
|
|
80
|
+
return this.startWithCommand(command)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// In development mode we use Nuxt CLI
|
|
84
|
+
if (!this.isProduction) {
|
|
85
|
+
await this.#startDevelopment()
|
|
86
|
+
} else {
|
|
87
|
+
await this.#startProduction()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
await this._collectMetrics()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async stop () {
|
|
94
|
+
await super.stop()
|
|
95
|
+
|
|
96
|
+
if (this.childManager) {
|
|
97
|
+
return this.stopCommand()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* c8 ignore next 3 */
|
|
101
|
+
if (!this.#server?.listening) {
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return this._closeServer(this.#server)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async build () {
|
|
109
|
+
if (!this.#nuxt) {
|
|
110
|
+
await this.init()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const config = this.config
|
|
114
|
+
return this.buildWithCommand(
|
|
115
|
+
config.application.commands.build ??
|
|
116
|
+
`node ${resolve(this.#nuxt)}/bin/nuxt.mjs build`,
|
|
117
|
+
this.#basePath
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async inject (injectParams, onInject) {
|
|
122
|
+
if (!this.isProduction) {
|
|
123
|
+
return injectViaRequest(this.url, injectParams, onInject)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const res = await inject(this.#dispatcher, injectParams, onInject)
|
|
127
|
+
|
|
128
|
+
if (onInject) {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const { statusCode, headers, body, payload, rawPayload } = res
|
|
133
|
+
return { statusCode, headers, body, payload, rawPayload }
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getMeta () {
|
|
137
|
+
const hasBasePath = this.basePath || this.#basePath
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
gateway: {
|
|
141
|
+
tcp: typeof this.url !== 'undefined',
|
|
142
|
+
url: this.url,
|
|
143
|
+
prefix: this.basePath ?? this.#basePath,
|
|
144
|
+
wantsAbsoluteUrls: !!hasBasePath,
|
|
145
|
+
needsRootTrailingSlash: false,
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* c8 ignore next 5 */
|
|
151
|
+
async getWatchConfig () {
|
|
152
|
+
return {
|
|
153
|
+
enabled: false,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async #startDevelopment () {
|
|
158
|
+
let { hostname, port, https } = this.serverConfig ?? {}
|
|
159
|
+
hostname ||= '127.0.0.1'
|
|
160
|
+
port ||= 0
|
|
161
|
+
let httpsArgs = ''
|
|
162
|
+
|
|
163
|
+
if (https) {
|
|
164
|
+
httpsArgs = ' --https'
|
|
165
|
+
|
|
166
|
+
const key = await sanitizeHTTPSArgument(https.key, true)
|
|
167
|
+
const cert = await sanitizeHTTPSArgument(https.cert, true)
|
|
168
|
+
|
|
169
|
+
if (https.key) {
|
|
170
|
+
httpsArgs += ` --https.key ${resolve(this.root, key)}`
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (https.cert) {
|
|
174
|
+
httpsArgs += ` --https.cert ${resolve(this.root, cert)}`
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
await this.startWithCommand(
|
|
179
|
+
`node ${resolve(this.#nuxt)}/bin/nuxt.mjs dev --host ${hostname} --port ${port} --no-open${httpsArgs}`
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
if (https) {
|
|
183
|
+
this.url = this.url.replace(/^http:/, 'https:')
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return this.url
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async #startProduction () {
|
|
190
|
+
const config = this.config
|
|
191
|
+
const outputDirectory = resolve(
|
|
192
|
+
this.root,
|
|
193
|
+
config.nuxt?.outputDirectory ?? '.output'
|
|
194
|
+
)
|
|
195
|
+
this.verifyOutputDirectory(outputDirectory)
|
|
196
|
+
// this.#basePath = await this._getBasePathFromBuildInfo()
|
|
197
|
+
|
|
198
|
+
const serverOptions = this.serverConfig
|
|
199
|
+
const serverPromise = createServerListener(
|
|
200
|
+
serverOptions?.port ?? true,
|
|
201
|
+
serverOptions?.hostname ?? true,
|
|
202
|
+
await buildAdditionalServerOptions(serverOptions)
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
const httpsOptions = await sanitizeHTTPSOptions(serverOptions?.https)
|
|
206
|
+
|
|
207
|
+
if (!httpsOptions?.cert && !httpsOptions?.key) {
|
|
208
|
+
await this.#importProductionNitro(outputDirectory)
|
|
209
|
+
} else {
|
|
210
|
+
const originalCert = process.env.NITRO_SSL_CERT
|
|
211
|
+
const originalKey = process.env.NITRO_SSL_KEY
|
|
212
|
+
|
|
213
|
+
process.env.NITRO_SSL_CERT = this.#serializeCertificateValue(
|
|
214
|
+
httpsOptions.cert
|
|
215
|
+
)
|
|
216
|
+
process.env.NITRO_SSL_KEY = this.#serializeCertificateValue(
|
|
217
|
+
httpsOptions.key
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
await this.#importProductionNitro(outputDirectory)
|
|
222
|
+
} finally {
|
|
223
|
+
this.#restoreEnvironmentVariables('NITRO_SSL_CERT', originalCert)
|
|
224
|
+
this.#restoreEnvironmentVariables('NITRO_SSL_KEY', originalKey)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
this.#server = await serverPromise
|
|
229
|
+
this.#dispatcher = this.#server.listeners('request')[0]
|
|
230
|
+
this.url = getServerUrl(this.#server)
|
|
231
|
+
await this._collectMetrics()
|
|
232
|
+
|
|
233
|
+
return this.url
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
#importProductionNitro (outputDirectory) {
|
|
237
|
+
return importFile(resolve(outputDirectory, 'server/index.mjs'))
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
#serializeCertificateValue (value) {
|
|
241
|
+
if (Array.isArray(value)) {
|
|
242
|
+
return value.map((item) => item.toString()).join('\n')
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return value.toString()
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
#restoreEnvironmentVariables (key, originalValue) {
|
|
249
|
+
if (typeof originalValue === 'undefined') {
|
|
250
|
+
delete process.env[key]
|
|
251
|
+
} else {
|
|
252
|
+
process.env[key] = originalValue
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
package/lib/schema.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { schemaComponents as basicSchemaComponents } from '@platformatic/basic'
|
|
2
|
+
import { schemaComponents as utilsSchemaComponents } from '@platformatic/foundation'
|
|
3
|
+
import { schemaComponents as viteSchemaComponents } from '@platformatic/vite'
|
|
4
|
+
import { readFileSync } from 'node:fs'
|
|
5
|
+
import { resolve } from 'node:path'
|
|
6
|
+
|
|
7
|
+
export const packageJson = JSON.parse(readFileSync(resolve(import.meta.dirname, '../package.json'), 'utf8'))
|
|
8
|
+
export const version = packageJson.version
|
|
9
|
+
|
|
10
|
+
export const nuxt = {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
outputDirectory: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: '.output'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
default: {},
|
|
19
|
+
additionalProperties: false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const schemaComponents = { nuxt }
|
|
23
|
+
|
|
24
|
+
export const schema = {
|
|
25
|
+
$id: `https://schemas.platformatic.dev/@platformatic/nuxt/${packageJson.version}.json`,
|
|
26
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
27
|
+
title: 'Platformatic Nuxt Config',
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
$schema: {
|
|
31
|
+
type: 'string'
|
|
32
|
+
},
|
|
33
|
+
module: {
|
|
34
|
+
type: 'string'
|
|
35
|
+
},
|
|
36
|
+
logger: utilsSchemaComponents.logger,
|
|
37
|
+
server: utilsSchemaComponents.server,
|
|
38
|
+
watch: basicSchemaComponents.watch,
|
|
39
|
+
application: basicSchemaComponents.buildableApplication,
|
|
40
|
+
runtime: utilsSchemaComponents.wrappedRuntime,
|
|
41
|
+
vite: viteSchemaComponents.vite,
|
|
42
|
+
nuxt
|
|
43
|
+
},
|
|
44
|
+
additionalProperties: false
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* c8 ignore next 3 */
|
|
48
|
+
if (process.argv[1] === import.meta.filename) {
|
|
49
|
+
console.log(JSON.stringify(schema, null, 2))
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/nuxt",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"license": "Apache-2.0",
|
|
3
|
+
"version": "3.58.1",
|
|
4
|
+
"description": "Platformatic Nuxt Capability",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "git+https://github.com/platformatic/platformatic.git"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
11
|
+
"author": "Platformatic Inc. <oss@platformatic.dev> (https://platformatic.dev)",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/platformatic/platformatic/issues"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
16
|
+
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"light-my-request": "^6.6.0",
|
|
19
|
+
"semver": "^7.6.3",
|
|
20
|
+
"@platformatic/basic": "3.58.1",
|
|
21
|
+
"@platformatic/vite": "3.58.1",
|
|
22
|
+
"@platformatic/foundation": "3.58.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@nuxt/cli": "^3.35.2",
|
|
26
|
+
"cleaner-spec-reporter": "^0.5.0",
|
|
27
|
+
"eslint": "9",
|
|
28
|
+
"json-schema-to-typescript": "^15.0.1",
|
|
29
|
+
"neostandard": "^0.12.0",
|
|
30
|
+
"nuxt": "^4.4.8",
|
|
31
|
+
"tstyche": "^6.2.0",
|
|
32
|
+
"typescript": "^5.5.4",
|
|
33
|
+
"vite": "^7.2.4",
|
|
34
|
+
"vue": "^3.5.22",
|
|
35
|
+
"ws": "^8.18.0",
|
|
36
|
+
"@platformatic/gateway": "3.58.1",
|
|
37
|
+
"@platformatic/service": "3.58.1"
|
|
38
|
+
},
|
|
26
39
|
"engines": {
|
|
27
|
-
"node": ">=
|
|
40
|
+
"node": ">=22.19.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "npm run test:types && node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
|
|
44
|
+
"test:types": "tstyche",
|
|
45
|
+
"gen-schema": "node lib/schema.js > schema.json",
|
|
46
|
+
"gen-types": "json2ts > config.d.ts < schema.json",
|
|
47
|
+
"build": "npm run gen-schema && npm run gen-types",
|
|
48
|
+
"lint": "eslint"
|
|
28
49
|
}
|
|
29
|
-
}
|
|
50
|
+
}
|