vite-plugin-react-deck 1.1.0 → 1.1.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/helpers.d.ts CHANGED
@@ -5,6 +5,6 @@ export declare function createAppDeckFile({ slidePath, theme, config, }: {
5
5
  slidePath: string;
6
6
  theme: string;
7
7
  config: {
8
- layoutsFile: string;
8
+ layoutsFile: string | undefined;
9
9
  };
10
10
  }): string;
package/index.cjs CHANGED
@@ -260,10 +260,11 @@ function createAppDeckFile({
260
260
  throw new Error(`Theme ${theme} not found`);
261
261
  }
262
262
  const themeObject = themes_exports[theme];
263
+ const layoutImport = config.layoutsFile ? `import layouts from "${config.layoutsFile}";` : "import { layouts } from '@gpichot/spectacle-deck';";
263
264
  return `import React, { StrictMode } from "react";
264
265
  import * as ReactDOM from "react-dom/client";
265
266
  import { Deck } from '@gpichot/spectacle-deck';
266
- import layouts from "${config.layoutsFile}";
267
+ ${layoutImport};
267
268
 
268
269
  import deck from "${slidePath}";
269
270
 
@@ -325,18 +326,16 @@ async function loadCustomConfig() {
325
326
  };
326
327
  }
327
328
  var src_default = async (options) => {
328
- const config = await loadCustomConfig();
329
- console.log(config);
330
329
  let isProd = false;
331
330
  const deckConfig = {
332
331
  decks: []
333
332
  };
334
333
  return {
335
334
  name: "react-deck",
336
- async config(config2) {
335
+ async config(config) {
337
336
  var _a, _b, _c;
338
337
  const decks = await glob.glob("./src/**/deck.mdx");
339
- const inputs = ((_b = (_a = config2.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.input) || {};
338
+ const inputs = ((_b = (_a = config.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.input) || {};
340
339
  deckConfig.decks = decks.map((deck) => ({
341
340
  originalFile: deck,
342
341
  index: deck.replace("/deck.mdx", "/index.html").replace("src/", "")
@@ -347,18 +346,18 @@ var src_default = async (options) => {
347
346
  }, []);
348
347
  const finalInputs = typeof inputs === "string" ? [inputs, ...decks] : Array.isArray(inputs) ? [...inputs, ...decks] : { ...inputs, ...newInputs };
349
348
  return {
350
- ...config2,
349
+ ...config,
351
350
  build: {
352
- ...config2.build,
351
+ ...config.build,
353
352
  rollupOptions: {
354
- ...(_c = config2.build) == null ? void 0 : _c.rollupOptions,
353
+ ...(_c = config.build) == null ? void 0 : _c.rollupOptions,
355
354
  input: finalInputs
356
355
  }
357
356
  }
358
357
  };
359
358
  },
360
- configResolved(config2) {
361
- isProd = config2.isProduction;
359
+ configResolved(config) {
360
+ isProd = config.isProduction;
362
361
  },
363
362
  resolveId(id) {
364
363
  if (deckConfig.decks.some((deck) => deck.index === id)) {
@@ -372,6 +371,7 @@ var src_default = async (options) => {
372
371
  }
373
372
  },
374
373
  async load(id) {
374
+ const config = await loadCustomConfig();
375
375
  const deck = deckConfig.decks.find((deck2) => deck2.index === id);
376
376
  if (deck) {
377
377
  return createIndexFile({
package/index.mjs CHANGED
@@ -239,10 +239,11 @@ function createAppDeckFile({
239
239
  throw new Error(`Theme ${theme} not found`);
240
240
  }
241
241
  const themeObject = themes_exports[theme];
242
+ const layoutImport = config.layoutsFile ? `import layouts from "${config.layoutsFile}";` : "import { layouts } from '@gpichot/spectacle-deck';";
242
243
  return `import React, { StrictMode } from "react";
243
244
  import * as ReactDOM from "react-dom/client";
244
245
  import { Deck } from '@gpichot/spectacle-deck';
245
- import layouts from "${config.layoutsFile}";
246
+ ${layoutImport};
246
247
 
247
248
  import deck from "${slidePath}";
248
249
 
@@ -309,18 +310,16 @@ async function loadCustomConfig() {
309
310
  };
310
311
  }
311
312
  var src_default = async (options) => {
312
- const config = await loadCustomConfig();
313
- console.log(config);
314
313
  let isProd = false;
315
314
  const deckConfig = {
316
315
  decks: []
317
316
  };
318
317
  return {
319
318
  name: "react-deck",
320
- async config(config2) {
319
+ async config(config) {
321
320
  var _a, _b, _c;
322
321
  const decks = await glob.glob("./src/**/deck.mdx");
323
- const inputs = ((_b = (_a = config2.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.input) || {};
322
+ const inputs = ((_b = (_a = config.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.input) || {};
324
323
  deckConfig.decks = decks.map((deck) => ({
325
324
  originalFile: deck,
326
325
  index: deck.replace("/deck.mdx", "/index.html").replace("src/", "")
@@ -331,18 +330,18 @@ var src_default = async (options) => {
331
330
  }, []);
332
331
  const finalInputs = typeof inputs === "string" ? [inputs, ...decks] : Array.isArray(inputs) ? [...inputs, ...decks] : { ...inputs, ...newInputs };
333
332
  return {
334
- ...config2,
333
+ ...config,
335
334
  build: {
336
- ...config2.build,
335
+ ...config.build,
337
336
  rollupOptions: {
338
- ...(_c = config2.build) == null ? void 0 : _c.rollupOptions,
337
+ ...(_c = config.build) == null ? void 0 : _c.rollupOptions,
339
338
  input: finalInputs
340
339
  }
341
340
  }
342
341
  };
343
342
  },
344
- configResolved(config2) {
345
- isProd = config2.isProduction;
343
+ configResolved(config) {
344
+ isProd = config.isProduction;
346
345
  },
347
346
  resolveId(id) {
348
347
  if (deckConfig.decks.some((deck) => deck.index === id)) {
@@ -356,6 +355,7 @@ var src_default = async (options) => {
356
355
  }
357
356
  },
358
357
  async load(id) {
358
+ const config = await loadCustomConfig();
359
359
  const deck = deckConfig.decks.find((deck2) => deck2.index === id);
360
360
  if (deck) {
361
361
  return createIndexFile({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-react-deck",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.cjs",