@scalar/nuxt 0.6.23 → 0.6.25
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/dist/module.json +1 -1
- package/dist/module.mjs +35 -31
- package/dist/shims/debug.js +26 -0
- package/dist/shims/extend.js +103 -0
- package/package.json +7 -6
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponent, extendPages } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponent, extendPages, addVitePlugin } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const module = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
@@ -26,36 +26,6 @@ const module = defineNuxtModule({
|
|
|
26
26
|
_nuxt.options.imports.transform ||= {};
|
|
27
27
|
_nuxt.options.imports.transform.exclude ||= [];
|
|
28
28
|
_nuxt.options.imports.transform.exclude.push(/scalar/);
|
|
29
|
-
_nuxt.options.vite ||= {};
|
|
30
|
-
_nuxt.options.vite.optimizeDeps ||= {};
|
|
31
|
-
_nuxt.options.vite.optimizeDeps.include ||= [];
|
|
32
|
-
_nuxt.options.vite.optimizeDeps.include.push(
|
|
33
|
-
"@scalar/nuxt > @scalar/api-reference",
|
|
34
|
-
"@scalar/nuxt > jsonpointer",
|
|
35
|
-
"@scalar/nuxt > ajv-draft-04",
|
|
36
|
-
"@scalar/nuxt > ajv-formats",
|
|
37
|
-
"@scalar/nuxt > ajv",
|
|
38
|
-
"@scalar/nuxt > ajv-draft-04 > ajv",
|
|
39
|
-
"@scalar/nuxt > ajv-formats > ajv",
|
|
40
|
-
"@scalar/nuxt > whatwg-mimetype",
|
|
41
|
-
"@scalar/nuxt > @scalar/openapi-parser",
|
|
42
|
-
"@scalar/nuxt > debug",
|
|
43
|
-
"@scalar/nuxt > extend",
|
|
44
|
-
"@scalar/nuxt > highlight.js"
|
|
45
|
-
);
|
|
46
|
-
_nuxt.options.vite.ssr ||= {};
|
|
47
|
-
if (Array.isArray(_nuxt.options.vite.ssr.noExternal)) {
|
|
48
|
-
_nuxt.options.vite.ssr.noExternal.push("ajv-draft-04", "ajv-formats", "ajv", "jsonpointer", "whatwg-mimetype");
|
|
49
|
-
} else {
|
|
50
|
-
_nuxt.options.vite.ssr.noExternal = [
|
|
51
|
-
...Array.isArray(_nuxt.options.vite.ssr.noExternal) ? _nuxt.options.vite.ssr.noExternal : [],
|
|
52
|
-
"ajv-draft-04",
|
|
53
|
-
"ajv-formats",
|
|
54
|
-
"ajv",
|
|
55
|
-
"jsonpointer",
|
|
56
|
-
"whatwg-mimetype"
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
29
|
_nuxt.hook("nitro:config", (config) => {
|
|
60
30
|
if (config.experimental?.openAPI) {
|
|
61
31
|
isOpenApiEnabled = true;
|
|
@@ -99,6 +69,40 @@ const module = defineNuxtModule({
|
|
|
99
69
|
});
|
|
100
70
|
}
|
|
101
71
|
});
|
|
72
|
+
const debugShim = resolver.resolve("./shims/debug.js");
|
|
73
|
+
const extendShim = resolver.resolve("./shims/extend.js");
|
|
74
|
+
addVitePlugin({
|
|
75
|
+
name: "scalar-cjs-shims",
|
|
76
|
+
enforce: "pre",
|
|
77
|
+
resolveId(source, importer) {
|
|
78
|
+
if (!importer?.includes("/node_modules/@scalar/")) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
if (source === "debug") {
|
|
82
|
+
return debugShim;
|
|
83
|
+
}
|
|
84
|
+
if (source === "extend") {
|
|
85
|
+
return extendShim;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
},
|
|
89
|
+
transform(code, id) {
|
|
90
|
+
if (!id.includes("/highlight.js/lib/core.js")) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
code: [
|
|
95
|
+
"const module = { exports: {} };",
|
|
96
|
+
"const exports = module.exports;",
|
|
97
|
+
"(function(module, exports) {",
|
|
98
|
+
code,
|
|
99
|
+
"})(module, exports);",
|
|
100
|
+
"export default module.exports;"
|
|
101
|
+
].join("\n"),
|
|
102
|
+
map: null
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
102
106
|
if (_nuxt.options.dev && _options.devtools) {
|
|
103
107
|
_nuxt.hook("devtools:customTabs", (tabs) => {
|
|
104
108
|
tabs.push({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Minimal ESM shim for the 'debug' package (CJS-only) to support Nuxt SSR builds
|
|
2
|
+
|
|
3
|
+
function createDebug() {
|
|
4
|
+
const noop = () => {}
|
|
5
|
+
noop.enabled = false
|
|
6
|
+
noop.log = noop
|
|
7
|
+
noop.extend = () => createDebug()
|
|
8
|
+
noop.destroy = () => true
|
|
9
|
+
noop.namespace = ''
|
|
10
|
+
return noop
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const debug = (namespace) => {
|
|
14
|
+
const fn = createDebug()
|
|
15
|
+
fn.namespace = namespace
|
|
16
|
+
return fn
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
debug.enable = () => {}
|
|
20
|
+
debug.disable = () => ''
|
|
21
|
+
debug.enabled = () => false
|
|
22
|
+
debug.names = []
|
|
23
|
+
debug.skips = []
|
|
24
|
+
debug.formatters = {}
|
|
25
|
+
|
|
26
|
+
export default debug
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// ESM port of https://github.com/justmoon/node-extend/blob/main/index.js
|
|
2
|
+
// Replaces the CJS-only 'extend' package for Nuxt SSR builds.
|
|
3
|
+
|
|
4
|
+
var hasOwn = Object.prototype.hasOwnProperty
|
|
5
|
+
var toStr = Object.prototype.toString
|
|
6
|
+
var defineProperty = Object.defineProperty
|
|
7
|
+
var gOPD = Object.getOwnPropertyDescriptor
|
|
8
|
+
|
|
9
|
+
var isArray = function isArray(arr) {
|
|
10
|
+
return Array.isArray(arr)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
var isPlainObject = function isPlainObject(obj) {
|
|
14
|
+
if (!obj || toStr.call(obj) !== '[object Object]') {
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var hasOwnConstructor = hasOwn.call(obj, 'constructor')
|
|
19
|
+
var hasIsPrototypeOf =
|
|
20
|
+
obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')
|
|
21
|
+
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var key
|
|
26
|
+
for (key in obj) {
|
|
27
|
+
/**/
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return typeof key === 'undefined' || hasOwn.call(obj, key)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
|
|
34
|
+
var setProperty = function setProperty(target, options) {
|
|
35
|
+
if (defineProperty && options.name === '__proto__') {
|
|
36
|
+
defineProperty(target, options.name, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
value: options.newValue,
|
|
40
|
+
writable: true,
|
|
41
|
+
})
|
|
42
|
+
} else {
|
|
43
|
+
target[options.name] = options.newValue
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Return undefined instead of __proto__ if '__proto__' is not an own property
|
|
48
|
+
var getProperty = function getProperty(obj, name) {
|
|
49
|
+
if (name === '__proto__') {
|
|
50
|
+
if (!hasOwn.call(obj, name)) {
|
|
51
|
+
return void 0
|
|
52
|
+
}
|
|
53
|
+
if (gOPD) {
|
|
54
|
+
return gOPD(obj, name).value
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return obj[name]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default function extend() {
|
|
62
|
+
var options, name, src, copy, copyIsArray, clone
|
|
63
|
+
var target = arguments[0]
|
|
64
|
+
var i = 1
|
|
65
|
+
var length = arguments.length
|
|
66
|
+
var deep = false
|
|
67
|
+
|
|
68
|
+
if (typeof target === 'boolean') {
|
|
69
|
+
deep = target
|
|
70
|
+
target = arguments[1] || {}
|
|
71
|
+
i = 2
|
|
72
|
+
}
|
|
73
|
+
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
|
|
74
|
+
target = {}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (; i < length; ++i) {
|
|
78
|
+
options = arguments[i]
|
|
79
|
+
if (options != null) {
|
|
80
|
+
for (name in options) {
|
|
81
|
+
src = getProperty(target, name)
|
|
82
|
+
copy = getProperty(options, name)
|
|
83
|
+
|
|
84
|
+
if (target !== copy) {
|
|
85
|
+
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
|
|
86
|
+
if (copyIsArray) {
|
|
87
|
+
copyIsArray = false
|
|
88
|
+
clone = src && isArray(src) ? src : []
|
|
89
|
+
} else {
|
|
90
|
+
clone = src && isPlainObject(src) ? src : {}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setProperty(target, { name: name, newValue: extend(deep, clone, copy) })
|
|
94
|
+
} else if (typeof copy !== 'undefined') {
|
|
95
|
+
setProperty(target, { name: name, newValue: copy })
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return target
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"testing",
|
|
21
21
|
"vue"
|
|
22
22
|
],
|
|
23
|
-
"version": "0.6.
|
|
23
|
+
"version": "0.6.25",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22"
|
|
26
26
|
},
|
|
@@ -54,20 +54,21 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@nuxt/kit": "^4.0.0",
|
|
56
56
|
"vue": "^3.5.30",
|
|
57
|
-
"@scalar/api-client": "3.
|
|
58
|
-
"@scalar/api-reference": "1.52.
|
|
59
|
-
"@scalar/
|
|
60
|
-
"@scalar/
|
|
57
|
+
"@scalar/api-client": "3.2.0",
|
|
58
|
+
"@scalar/api-reference": "1.52.4",
|
|
59
|
+
"@scalar/use-hooks": "0.4.3",
|
|
60
|
+
"@scalar/types": "0.9.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@nuxt/module-builder": "^1.0.1",
|
|
64
64
|
"@types/node": "^24.1.0",
|
|
65
65
|
"cross-env": "10.1.0",
|
|
66
66
|
"nuxt": "^4.1.0",
|
|
67
|
+
"shx": "^0.4.0",
|
|
67
68
|
"vitest": "4.1.0"
|
|
68
69
|
},
|
|
69
70
|
"scripts": {
|
|
70
|
-
"build": "cross-env NUXT_TELEMETRY_DISABLED=false pnpm dev:prepare && nuxt-module-build build",
|
|
71
|
+
"build": "cross-env NUXT_TELEMETRY_DISABLED=false pnpm dev:prepare && nuxt-module-build build && shx cp -r src/shims dist/shims",
|
|
71
72
|
"dev": "pnpm dev:prepare && nuxi dev playground",
|
|
72
73
|
"dev:build": "nuxi build playground",
|
|
73
74
|
"dev:prepare": "nuxi prepare && nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|