@ox-content/vite-plugin 2.2.0 → 2.3.0
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 +21 -0
- package/dist/index.cjs +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ubugeeei
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -7520,11 +7520,22 @@ function renderDetailsControlsHtml(targetSelector) {
|
|
|
7520
7520
|
<button type="button" class="ox-api-controls__button" data-ox-api-toggle="collapse">Close all</button>
|
|
7521
7521
|
</div>`;
|
|
7522
7522
|
}
|
|
7523
|
+
function normalizeDocFilePath(filePath) {
|
|
7524
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
7525
|
+
return normalized.match(/(?:^|\/)((?:npm|packages|crates|src)\/.+)$/)?.[1] ?? normalized.replace(/^\/+/, "");
|
|
7526
|
+
}
|
|
7523
7527
|
function buildDocsData(docs) {
|
|
7524
7528
|
return {
|
|
7525
7529
|
version: 1,
|
|
7526
7530
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7527
|
-
modules: docs
|
|
7531
|
+
modules: docs.map((doc) => ({
|
|
7532
|
+
...doc,
|
|
7533
|
+
file: normalizeDocFilePath(doc.file),
|
|
7534
|
+
entries: doc.entries.map((entry) => ({
|
|
7535
|
+
...entry,
|
|
7536
|
+
file: normalizeDocFilePath(entry.file)
|
|
7537
|
+
}))
|
|
7538
|
+
}))
|
|
7528
7539
|
};
|
|
7529
7540
|
}
|
|
7530
7541
|
/**
|
|
@@ -8054,7 +8065,7 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
8054
8065
|
* @returns Absolute GitHub URL to source code
|
|
8055
8066
|
*/
|
|
8056
8067
|
function generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8057
|
-
return `${githubUrl}/blob/main/${filePath
|
|
8068
|
+
return `${githubUrl}/blob/main/${normalizeDocFilePath(filePath)}${lineNumber ? endLineNumber && endLineNumber > lineNumber ? `#L${lineNumber}-L${endLineNumber}` : `#L${lineNumber}` : ""}`;
|
|
8058
8069
|
}
|
|
8059
8070
|
function generateSourceLink(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8060
8071
|
return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber)})**`;
|