@diplodoc/tabs-extension 3.10.8-transform5.0 → 3.10.8-transform5.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/README.md CHANGED
@@ -264,12 +264,10 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
264
264
 
265
265
  ## MarkdownIt compatibility
266
266
 
267
- The plugin supports MarkdownIt 13 and 15. Its types are derived from the public
268
- parser constructor, so consumers use the declarations of their installed parser.
269
- Tokens are created by the active parser state; no private MarkdownIt module is
270
- loaded at runtime.
271
-
272
- TypeScript consumers require TypeScript 5.3 or newer for import resolution
273
- attributes; the strict installed-package matrix was tested with TypeScript 6.0.3.
274
- For MarkdownIt 15, native CommonJS declarations use an explicit import-mode type
275
- query to avoid the upstream 15.0.3 CommonJS declaration shim issue.
267
+ The plugin supports MarkdownIt 13, 14 and 15. Its plugin callback describes the
268
+ core rule and token capabilities it uses, so different supported parser versions
269
+ can coexist in a TypeScript application. Tokens are created by the active parser
270
+ state; no private MarkdownIt module is loaded at runtime.
271
+
272
+ The installed-package compatibility tests use TypeScript 6.0.3 with NodeNext
273
+ module resolution and `skipLibCheck: false`, including CommonJS and ESM hosts.
@@ -1,6 +1,3 @@
1
- import { type PluginOptions } from './transform';
1
+ import { type PluginOptions, type TabsPlugin } from './transform';
2
2
  export * from './index';
3
- export declare function transform(options?: Partial<PluginOptions>): (md: import("./markdown-it").MarkdownIt, options?: {
4
- output?: string;
5
- generateID?: import("@diplodoc/utils").IDGenerator;
6
- }) => void;
3
+ export declare function transform(options?: Partial<PluginOptions>): TabsPlugin;
@@ -1304,6 +1304,19 @@ var defaultFeatures = {
1304
1304
  }
1305
1305
  };
1306
1306
  var runsCounter = 0;
1307
+ function appendRuntimeMeta(env, runtimeJsPath, runtimeCssPath) {
1308
+ const meta = env.meta || (env.meta = {});
1309
+ if (typeof meta !== "object" || meta === null) {
1310
+ throw new TypeError("Expected env.meta to be an object.");
1311
+ }
1312
+ if (!("script" in meta) || !meta.script) Object.assign(meta, { script: [] });
1313
+ if (!("style" in meta) || !meta.style) Object.assign(meta, { style: [] });
1314
+ if (!("script" in meta) || !Array.isArray(meta.script) || !("style" in meta) || !Array.isArray(meta.style)) {
1315
+ throw new TypeError("Expected runtime script and style arrays.");
1316
+ }
1317
+ meta.script.push(runtimeJsPath);
1318
+ meta.style.push(runtimeCssPath);
1319
+ }
1307
1320
  function transform(options = {}) {
1308
1321
  const {
1309
1322
  runtimeJsPath = "_assets/tabs-extension.js",
@@ -1354,17 +1367,7 @@ function transform(options = {}) {
1354
1367
  }
1355
1368
  }
1356
1369
  if (tabsAreInserted) {
1357
- const meta = env.meta || (env.meta = {});
1358
- if (typeof meta !== "object" || meta === null) {
1359
- throw new TypeError("Expected env.meta to be an object.");
1360
- }
1361
- if (!("script" in meta) || !meta.script) Object.assign(meta, { script: [] });
1362
- if (!("style" in meta) || !meta.style) Object.assign(meta, { style: [] });
1363
- if (!("script" in meta) || !Array.isArray(meta.script) || !("style" in meta) || !Array.isArray(meta.style)) {
1364
- throw new TypeError("Expected runtime script and style arrays.");
1365
- }
1366
- meta.script.push(runtimeJsPath);
1367
- meta.style.push(runtimeCssPath);
1370
+ appendRuntimeMeta(env, runtimeJsPath, runtimeCssPath);
1368
1371
  if (bundle && onBundle2) {
1369
1372
  onBundle2({ runtimeJsPath, runtimeCssPath, output }, env.bundled);
1370
1373
  }