starlight-cannoli-plugins 2.1.7 → 2.1.8
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.
|
@@ -134,10 +134,11 @@ function syncDocsToPublic(options) {
|
|
|
134
134
|
const srcDir = resolve(DEFAULT_SRC_DIR);
|
|
135
135
|
const publicDir = resolve(DEFAULT_PUBLIC_DIR);
|
|
136
136
|
const {
|
|
137
|
-
preserveDirs,
|
|
137
|
+
preserveDirs: rawPreserveDirs,
|
|
138
138
|
ignorePatterns = [],
|
|
139
139
|
exposePageSrcButton = false
|
|
140
140
|
} = options;
|
|
141
|
+
const preserveDirs = rawPreserveDirs.map((d) => d.replace(/\/+$/, ""));
|
|
141
142
|
return {
|
|
142
143
|
name: "astro-sync-docs-to-public",
|
|
143
144
|
hooks: {
|
|
@@ -145,15 +146,21 @@ function syncDocsToPublic(options) {
|
|
|
145
146
|
validateOptions(options);
|
|
146
147
|
if (exposePageSrcButton) {
|
|
147
148
|
const currentFile = fileURLToPath(import.meta.url);
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
let pageScriptUrl;
|
|
150
|
+
if (currentFile.endsWith(".ts")) {
|
|
151
|
+
pageScriptUrl = new URL("./page-script.ts", import.meta.url);
|
|
152
|
+
} else if (currentFile.endsWith("astro-sync-docs-to-public.js")) {
|
|
153
|
+
pageScriptUrl = new URL(
|
|
150
154
|
"./astro-sync-docs-to-public/page-script.js",
|
|
151
155
|
import.meta.url
|
|
152
|
-
)
|
|
156
|
+
);
|
|
157
|
+
} else {
|
|
158
|
+
pageScriptUrl = new URL(
|
|
153
159
|
"./plugins/astro-sync-docs-to-public/page-script.js",
|
|
154
160
|
import.meta.url
|
|
155
|
-
)
|
|
156
|
-
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const scriptPath = fileURLToPath(pageScriptUrl);
|
|
157
164
|
injectScript("page", `import ${JSON.stringify(scriptPath)};`);
|
|
158
165
|
}
|
|
159
166
|
},
|
|
@@ -203,9 +210,7 @@ function syncDocsToPublic(options) {
|
|
|
203
210
|
}
|
|
204
211
|
};
|
|
205
212
|
}
|
|
206
|
-
var starlightSyncDocsToPublic = syncDocsToPublic;
|
|
207
213
|
|
|
208
214
|
export {
|
|
209
|
-
syncDocsToPublic
|
|
210
|
-
starlightSyncDocsToPublic
|
|
215
|
+
syncDocsToPublic
|
|
211
216
|
};
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,5 @@ interface SyncDocsToPublicOptions {
|
|
|
19
19
|
exposePageSrcButton?: boolean;
|
|
20
20
|
}
|
|
21
21
|
declare function syncDocsToPublic(options: SyncDocsToPublicOptions): AstroIntegration;
|
|
22
|
-
/** @deprecated Use {@link syncDocsToPublic} instead. */
|
|
23
|
-
declare const starlightSyncDocsToPublic: typeof syncDocsToPublic;
|
|
24
22
|
|
|
25
|
-
export { type SyncDocsToPublicOptions,
|
|
23
|
+
export { type SyncDocsToPublicOptions, syncDocsToPublic };
|
package/package.json
CHANGED