@despia/local 1.0.0 → 1.0.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 +32 -32
- package/package.json +1 -1
- package/src/astro.js +4 -4
- package/src/esbuild.js +4 -4
- package/src/index.js +10 -10
- package/src/next.js +12 -12
- package/src/nuxt.js +6 -6
- package/src/parcel.js +3 -3
- package/src/remix.js +4 -4
- package/src/rollup.js +2 -2
- package/src/sveltekit.js +4 -4
- package/src/turbopack.js +2 -2
- package/src/vite.js +2 -2
- package/src/webpack.js +3 -3
package/README.md
CHANGED
|
@@ -353,12 +353,12 @@ npx despia-local [outputDir] [entryHtml]
|
|
|
353
353
|
```javascript
|
|
354
354
|
// vite.config.js
|
|
355
355
|
import { defineConfig } from 'vite';
|
|
356
|
-
import {
|
|
356
|
+
import { despiaLocalPlugin } from '@despia/local/vite';
|
|
357
357
|
|
|
358
358
|
export default defineConfig({
|
|
359
359
|
plugins: [
|
|
360
360
|
// ... your other plugins
|
|
361
|
-
|
|
361
|
+
despiaLocalPlugin({
|
|
362
362
|
outDir: 'dist', // optional, default: 'dist'
|
|
363
363
|
entryHtml: 'index.html' // optional, default: 'index.html'
|
|
364
364
|
})
|
|
@@ -378,13 +378,13 @@ export default defineConfig({
|
|
|
378
378
|
|
|
379
379
|
```javascript
|
|
380
380
|
// webpack.config.js
|
|
381
|
-
const
|
|
381
|
+
const DespiaLocalPlugin = require('@despia/local/webpack');
|
|
382
382
|
|
|
383
383
|
module.exports = {
|
|
384
384
|
// ... your config
|
|
385
385
|
plugins: [
|
|
386
386
|
// ... your other plugins
|
|
387
|
-
new
|
|
387
|
+
new DespiaLocalPlugin({
|
|
388
388
|
outDir: 'dist', // optional, default: 'dist'
|
|
389
389
|
entryHtml: 'index.html' // optional, default: 'index.html'
|
|
390
390
|
})
|
|
@@ -402,13 +402,13 @@ module.exports = {
|
|
|
402
402
|
|
|
403
403
|
```javascript
|
|
404
404
|
// rollup.config.js
|
|
405
|
-
import {
|
|
405
|
+
import { despiaLocal } from '@despia/local/rollup';
|
|
406
406
|
|
|
407
407
|
export default {
|
|
408
408
|
// ... your config
|
|
409
409
|
plugins: [
|
|
410
410
|
// ... your other plugins
|
|
411
|
-
|
|
411
|
+
despiaLocal({
|
|
412
412
|
outDir: 'dist',
|
|
413
413
|
entryHtml: 'index.html'
|
|
414
414
|
})
|
|
@@ -420,9 +420,9 @@ export default {
|
|
|
420
420
|
|
|
421
421
|
```javascript
|
|
422
422
|
// next.config.js
|
|
423
|
-
const
|
|
423
|
+
const withDespiaLocal = require('@despia/local/next');
|
|
424
424
|
|
|
425
|
-
module.exports =
|
|
425
|
+
module.exports = withDespiaLocal({
|
|
426
426
|
entryHtml: 'index.html',
|
|
427
427
|
outDir: '.next' // or 'out' for static export
|
|
428
428
|
})({
|
|
@@ -434,9 +434,9 @@ module.exports = withDespiaOffline({
|
|
|
434
434
|
|
|
435
435
|
```javascript
|
|
436
436
|
// next.config.js
|
|
437
|
-
const
|
|
437
|
+
const withDespiaLocal = require('@despia/local/next');
|
|
438
438
|
|
|
439
|
-
module.exports =
|
|
439
|
+
module.exports = withDespiaLocal({
|
|
440
440
|
outDir: 'out', // Next.js static export directory
|
|
441
441
|
entryHtml: 'index.html'
|
|
442
442
|
})({
|
|
@@ -449,12 +449,12 @@ module.exports = withDespiaOffline({
|
|
|
449
449
|
|
|
450
450
|
```javascript
|
|
451
451
|
// next.config.js
|
|
452
|
-
const
|
|
452
|
+
const DespiaLocalPlugin = require('@despia/local/webpack');
|
|
453
453
|
|
|
454
454
|
module.exports = {
|
|
455
455
|
webpack: (config) => {
|
|
456
456
|
config.plugins.push(
|
|
457
|
-
new
|
|
457
|
+
new DespiaLocalPlugin({ outDir: '.next' })
|
|
458
458
|
);
|
|
459
459
|
return config;
|
|
460
460
|
}
|
|
@@ -467,7 +467,7 @@ module.exports = {
|
|
|
467
467
|
// nuxt.config.js
|
|
468
468
|
export default {
|
|
469
469
|
modules: ['@despia/local/nuxt'],
|
|
470
|
-
|
|
470
|
+
despiaLocal: {
|
|
471
471
|
entryHtml: 'index.html'
|
|
472
472
|
}
|
|
473
473
|
}
|
|
@@ -476,9 +476,9 @@ export default {
|
|
|
476
476
|
**Or as a local module:**
|
|
477
477
|
|
|
478
478
|
```javascript
|
|
479
|
-
// modules/despia-
|
|
480
|
-
import
|
|
481
|
-
export default
|
|
479
|
+
// modules/despia-local.js
|
|
480
|
+
import DespiaLocalModule from '@despia/local/nuxt';
|
|
481
|
+
export default DespiaLocalModule;
|
|
482
482
|
```
|
|
483
483
|
|
|
484
484
|
### SvelteKit
|
|
@@ -486,12 +486,12 @@ export default DespiaOfflineModule;
|
|
|
486
486
|
```javascript
|
|
487
487
|
// vite.config.js
|
|
488
488
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
489
|
-
import {
|
|
489
|
+
import { despiaLocalSvelteKit } from '@despia/local/sveltekit';
|
|
490
490
|
|
|
491
491
|
export default {
|
|
492
492
|
plugins: [
|
|
493
493
|
sveltekit(),
|
|
494
|
-
|
|
494
|
+
despiaLocalSvelteKit({
|
|
495
495
|
entryHtml: 'index.html'
|
|
496
496
|
})
|
|
497
497
|
]
|
|
@@ -503,11 +503,11 @@ export default {
|
|
|
503
503
|
```javascript
|
|
504
504
|
// astro.config.mjs
|
|
505
505
|
import { defineConfig } from 'astro/config';
|
|
506
|
-
import
|
|
506
|
+
import despiaLocal from '@despia/local/astro';
|
|
507
507
|
|
|
508
508
|
export default defineConfig({
|
|
509
509
|
integrations: [
|
|
510
|
-
|
|
510
|
+
despiaLocal({
|
|
511
511
|
entryHtml: 'index.html',
|
|
512
512
|
outDir: 'dist'
|
|
513
513
|
})
|
|
@@ -520,12 +520,12 @@ export default defineConfig({
|
|
|
520
520
|
```javascript
|
|
521
521
|
// vite.config.js (Remix uses Vite)
|
|
522
522
|
import { remix } from '@remix-run/dev';
|
|
523
|
-
import {
|
|
523
|
+
import { despiaLocalRemix } from '@despia/local/remix';
|
|
524
524
|
|
|
525
525
|
export default {
|
|
526
526
|
plugins: [
|
|
527
527
|
remix(),
|
|
528
|
-
|
|
528
|
+
despiaLocalRemix({
|
|
529
529
|
entryHtml: 'index.html',
|
|
530
530
|
outDir: 'build/client'
|
|
531
531
|
})
|
|
@@ -537,13 +537,13 @@ export default {
|
|
|
537
537
|
|
|
538
538
|
```javascript
|
|
539
539
|
import { build } from 'esbuild';
|
|
540
|
-
import {
|
|
540
|
+
import { despiaLocalEsbuild } from '@despia/local/esbuild';
|
|
541
541
|
|
|
542
542
|
await build({
|
|
543
543
|
entryPoints: ['src/index.js'],
|
|
544
544
|
outdir: 'dist',
|
|
545
545
|
plugins: [
|
|
546
|
-
|
|
546
|
+
despiaLocalEsbuild({
|
|
547
547
|
outDir: 'dist',
|
|
548
548
|
entryHtml: 'index.html'
|
|
549
549
|
})
|
|
@@ -618,12 +618,12 @@ The generated `despia/local.json` file contains a sorted JSON array of root-rela
|
|
|
618
618
|
// vite.config.js
|
|
619
619
|
import { defineConfig } from 'vite';
|
|
620
620
|
import react from '@vitejs/plugin-react';
|
|
621
|
-
import {
|
|
621
|
+
import { despiaLocalPlugin } from '@despia/local/vite';
|
|
622
622
|
|
|
623
623
|
export default defineConfig({
|
|
624
624
|
plugins: [
|
|
625
625
|
react(),
|
|
626
|
-
|
|
626
|
+
despiaLocalPlugin()
|
|
627
627
|
]
|
|
628
628
|
});
|
|
629
629
|
```
|
|
@@ -634,12 +634,12 @@ export default defineConfig({
|
|
|
634
634
|
// vite.config.js
|
|
635
635
|
import { defineConfig } from 'vite';
|
|
636
636
|
import vue from '@vitejs/plugin-vue';
|
|
637
|
-
import {
|
|
637
|
+
import { despiaLocalPlugin } from '@despia/local/vite';
|
|
638
638
|
|
|
639
639
|
export default defineConfig({
|
|
640
640
|
plugins: [
|
|
641
641
|
vue(),
|
|
642
|
-
|
|
642
|
+
despiaLocalPlugin()
|
|
643
643
|
]
|
|
644
644
|
});
|
|
645
645
|
```
|
|
@@ -668,11 +668,11 @@ export default defineConfig({
|
|
|
668
668
|
|
|
669
669
|
```javascript
|
|
670
670
|
// webpack.config.js
|
|
671
|
-
const
|
|
671
|
+
const DespiaLocalPlugin = require('@despia/local/webpack');
|
|
672
672
|
|
|
673
673
|
module.exports = {
|
|
674
674
|
plugins: [
|
|
675
|
-
new
|
|
675
|
+
new DespiaLocalPlugin({ outDir: 'dist' })
|
|
676
676
|
]
|
|
677
677
|
};
|
|
678
678
|
```
|
|
@@ -683,12 +683,12 @@ module.exports = {
|
|
|
683
683
|
// vite.config.js
|
|
684
684
|
import { defineConfig } from 'vite';
|
|
685
685
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
686
|
-
import {
|
|
686
|
+
import { despiaLocalPlugin } from '@despia/local/vite';
|
|
687
687
|
|
|
688
688
|
export default defineConfig({
|
|
689
689
|
plugins: [
|
|
690
690
|
svelte(),
|
|
691
|
-
|
|
691
|
+
despiaLocalPlugin()
|
|
692
692
|
]
|
|
693
693
|
});
|
|
694
694
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@despia/local",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Universal build plugin to generate despia/local.json manifest for offline caching in Despia web-native apps. Supports Vite, Webpack, Rollup, Next.js, Nuxt, SvelteKit, Astro, Remix, esbuild, Parcel, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/core.js",
|
package/src/astro.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage in astro.config.mjs:
|
|
5
5
|
* import { defineConfig } from 'astro/config';
|
|
6
|
-
* import
|
|
6
|
+
* import despiaLocal from '@despia/local/astro';
|
|
7
7
|
*
|
|
8
8
|
* export default defineConfig({
|
|
9
9
|
* integrations: [
|
|
10
|
-
*
|
|
10
|
+
* despiaLocal({ entryHtml: 'index.html' })
|
|
11
11
|
* ]
|
|
12
12
|
* });
|
|
13
13
|
*/
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
import { generateManifest } from './core.js';
|
|
16
16
|
import { fileURLToPath } from 'url';
|
|
17
17
|
|
|
18
|
-
export default function
|
|
18
|
+
export default function despiaLocalIntegration(options = {}) {
|
|
19
19
|
const { entryHtml = 'index.html', outDir = 'dist' } = options;
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
|
-
name: 'despia-
|
|
22
|
+
name: 'despia-local',
|
|
23
23
|
hooks: {
|
|
24
24
|
'astro:build:done': async ({ dir }) => {
|
|
25
25
|
// Astro provides dir as a URL object, convert to path
|
package/src/esbuild.js
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage:
|
|
5
5
|
* import { build } from 'esbuild';
|
|
6
|
-
* import {
|
|
6
|
+
* import { despiaLocalEsbuild } from '@despia/local/esbuild';
|
|
7
7
|
*
|
|
8
8
|
* await build({
|
|
9
|
-
* plugins: [
|
|
9
|
+
* plugins: [despiaLocalEsbuild({ outDir: 'dist' })]
|
|
10
10
|
* });
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { generateManifest } from './core.js';
|
|
14
14
|
import { relative } from 'path';
|
|
15
15
|
|
|
16
|
-
export function
|
|
16
|
+
export function despiaLocalEsbuild(options = {}) {
|
|
17
17
|
const { outDir = 'dist', entryHtml = 'index.html' } = options;
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
|
-
name: 'despia-
|
|
20
|
+
name: 'despia-local',
|
|
21
21
|
setup(build) {
|
|
22
22
|
build.onEnd(async (result) => {
|
|
23
23
|
if (result.errors.length > 0) {
|
package/src/index.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export { generateManifest, collectFiles } from './core.js';
|
|
7
|
-
export {
|
|
8
|
-
export { default as
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export { default as
|
|
12
|
-
export {
|
|
13
|
-
export { default as
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export { default as
|
|
7
|
+
export { despiaLocalPlugin } from './vite.js';
|
|
8
|
+
export { default as DespiaLocalPlugin } from './webpack.js';
|
|
9
|
+
export { despiaLocal } from './rollup.js';
|
|
10
|
+
export { withDespiaLocal } from './next.js';
|
|
11
|
+
export { default as DespiaLocalModule } from './nuxt.js';
|
|
12
|
+
export { despiaLocalSvelteKit } from './sveltekit.js';
|
|
13
|
+
export { default as despiaLocalIntegration } from './astro.js';
|
|
14
|
+
export { despiaLocalRemix } from './remix.js';
|
|
15
|
+
export { despiaLocalEsbuild } from './esbuild.js';
|
|
16
|
+
export { default as DespiaLocalParcel } from './parcel.js';
|
package/src/next.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Next.js integration for generating despia/local.json manifest
|
|
3
3
|
*
|
|
4
4
|
* Usage in next.config.js:
|
|
5
|
-
* const
|
|
6
|
-
* module.exports =
|
|
5
|
+
* const withDespiaLocal = require('@despia/local/next');
|
|
6
|
+
* module.exports = withDespiaLocal({
|
|
7
7
|
* entryHtml: 'index.html',
|
|
8
8
|
* outDir: '.next' // or 'out' for static export
|
|
9
9
|
* })({
|
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
* });
|
|
12
12
|
*
|
|
13
13
|
* Or use the webpack plugin approach:
|
|
14
|
-
* const
|
|
14
|
+
* const DespiaLocalPlugin = require('@despia/local/webpack');
|
|
15
15
|
* module.exports = {
|
|
16
16
|
* webpack: (config) => {
|
|
17
|
-
* config.plugins.push(new
|
|
17
|
+
* config.plugins.push(new DespiaLocalPlugin({ outDir: '.next' }));
|
|
18
18
|
* return config;
|
|
19
19
|
* }
|
|
20
20
|
* };
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { generateManifest } from './core.js';
|
|
24
|
-
import
|
|
24
|
+
import DespiaLocalPlugin from './webpack.js';
|
|
25
25
|
|
|
26
|
-
export function
|
|
27
|
-
const
|
|
26
|
+
export function withDespiaLocal(pluginOptions = {}) {
|
|
27
|
+
const localConfig = {
|
|
28
28
|
outDir: pluginOptions.outDir || '.next',
|
|
29
29
|
entryHtml: pluginOptions.entryHtml || 'index.html',
|
|
30
30
|
...pluginOptions
|
|
@@ -36,11 +36,11 @@ export function withDespiaOffline(pluginOptions = {}) {
|
|
|
36
36
|
return {
|
|
37
37
|
...nextConfig,
|
|
38
38
|
webpack: (config, options) => {
|
|
39
|
-
// Add Despia
|
|
39
|
+
// Add Despia Local plugin
|
|
40
40
|
config.plugins.push(
|
|
41
|
-
new
|
|
42
|
-
outDir:
|
|
43
|
-
entryHtml:
|
|
41
|
+
new DespiaLocalPlugin({
|
|
42
|
+
outDir: localConfig.outDir,
|
|
43
|
+
entryHtml: localConfig.entryHtml
|
|
44
44
|
})
|
|
45
45
|
);
|
|
46
46
|
|
|
@@ -56,4 +56,4 @@ export function withDespiaOffline(pluginOptions = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// Also export as CommonJS for Next.js compatibility
|
|
59
|
-
export default
|
|
59
|
+
export default withDespiaLocal;
|
package/src/nuxt.js
CHANGED
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
* Usage in nuxt.config.js:
|
|
5
5
|
* export default {
|
|
6
6
|
* modules: ['@despia/local/nuxt'],
|
|
7
|
-
*
|
|
7
|
+
* despiaLocal: {
|
|
8
8
|
* entryHtml: 'index.html'
|
|
9
9
|
* }
|
|
10
10
|
* }
|
|
11
11
|
*
|
|
12
12
|
* Or use as a Nuxt module in modules/ directory:
|
|
13
|
-
* // modules/despia-
|
|
14
|
-
* import
|
|
15
|
-
* export default
|
|
13
|
+
* // modules/despia-local.js
|
|
14
|
+
* import DespiaLocalModule from '@despia/local/nuxt';
|
|
15
|
+
* export default DespiaLocalModule;
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { generateManifest } from './core.js';
|
|
19
19
|
|
|
20
|
-
export default function
|
|
20
|
+
export default function DespiaLocalModule(moduleOptions) {
|
|
21
21
|
const options = {
|
|
22
22
|
entryHtml: 'index.html',
|
|
23
23
|
...moduleOptions,
|
|
24
|
-
...(this.options?.
|
|
24
|
+
...(this.options?.despiaLocal || {})
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// Hook into Nuxt build completion
|
package/src/parcel.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* "scripts": {
|
|
8
8
|
* "build": "parcel build",
|
|
9
|
-
* "postbuild": "despia-
|
|
9
|
+
* "postbuild": "despia-local dist"
|
|
10
10
|
* }
|
|
11
11
|
*
|
|
12
12
|
* For Parcel 1.x, you can use this plugin, but the API may vary.
|
|
@@ -19,7 +19,7 @@ export default function(api) {
|
|
|
19
19
|
const { outDir = 'dist', entryHtml = 'index.html' } = api.options || {};
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
|
-
name: 'despia-
|
|
22
|
+
name: 'despia-local',
|
|
23
23
|
async bundleEnd({ bundleGraph }) {
|
|
24
24
|
const additionalPaths = [];
|
|
25
25
|
|
|
@@ -43,7 +43,7 @@ export default function(api) {
|
|
|
43
43
|
console.log(`✓ Generated despia/local.json with ${paths.length} assets`);
|
|
44
44
|
} catch (error) {
|
|
45
45
|
console.error('Error generating despia/local.json:', error.message);
|
|
46
|
-
console.warn('💡 Tip: For Parcel projects, use the standalone CLI: "despia-
|
|
46
|
+
console.warn('💡 Tip: For Parcel projects, use the standalone CLI: "despia-local dist"');
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
};
|
package/src/remix.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage in remix.config.js or vite.config.js:
|
|
5
5
|
* import { remix } from '@remix-run/dev';
|
|
6
|
-
* import {
|
|
6
|
+
* import { despiaLocalRemix } from '@despia/local/remix';
|
|
7
7
|
*
|
|
8
8
|
* export default {
|
|
9
9
|
* plugins: [
|
|
10
10
|
* remix(),
|
|
11
|
-
*
|
|
11
|
+
* despiaLocalRemix({ entryHtml: 'index.html' })
|
|
12
12
|
* ]
|
|
13
13
|
* }
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { generateManifest } from './core.js';
|
|
17
17
|
|
|
18
|
-
export function
|
|
18
|
+
export function despiaLocalRemix(options = {}) {
|
|
19
19
|
const { entryHtml = 'index.html', outDir = 'build/client' } = options;
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
|
-
name: 'despia-
|
|
22
|
+
name: 'despia-local-remix',
|
|
23
23
|
apply: 'build',
|
|
24
24
|
buildEnd() {
|
|
25
25
|
// Remix outputs to build/client for client assets
|
package/src/rollup.js
CHANGED
|
@@ -10,11 +10,11 @@ import { generateManifest } from './core.js';
|
|
|
10
10
|
* @param {string} options.outDir - Output directory (default: 'dist')
|
|
11
11
|
* @param {string} options.entryHtml - Entry HTML file (default: 'index.html')
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function despiaLocal(options = {}) {
|
|
14
14
|
const { outDir = 'dist', entryHtml = 'index.html' } = options;
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
|
-
name: 'despia-
|
|
17
|
+
name: 'despia-local',
|
|
18
18
|
writeBundle(outputOptions, bundle) {
|
|
19
19
|
const outputDir = outputOptions.dir || outDir;
|
|
20
20
|
const additionalPaths = [];
|
package/src/sveltekit.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Usage in vite.config.js:
|
|
5
5
|
* import { sveltekit } from '@sveltejs/kit/vite';
|
|
6
|
-
* import {
|
|
6
|
+
* import { despiaLocalSvelteKit } from '@despia/local/sveltekit';
|
|
7
7
|
*
|
|
8
8
|
* export default {
|
|
9
9
|
* plugins: [
|
|
10
10
|
* sveltekit(),
|
|
11
|
-
*
|
|
11
|
+
* despiaLocalSvelteKit({ entryHtml: 'index.html' })
|
|
12
12
|
* ]
|
|
13
13
|
* }
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { generateManifest } from './core.js';
|
|
17
17
|
|
|
18
|
-
export function
|
|
18
|
+
export function despiaLocalSvelteKit(options = {}) {
|
|
19
19
|
const { entryHtml = 'index.html' } = options;
|
|
20
20
|
|
|
21
21
|
return {
|
|
22
|
-
name: 'despia-
|
|
22
|
+
name: 'despia-local-sveltekit',
|
|
23
23
|
apply: 'build',
|
|
24
24
|
buildEnd() {
|
|
25
25
|
// SvelteKit outputs to build directory
|
package/src/turbopack.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { generateManifest } from './core.js';
|
|
8
8
|
|
|
9
|
-
export function
|
|
9
|
+
export function despiaLocalTurbopack(options = {}) {
|
|
10
10
|
const { entryHtml = 'index.html', outDir = '.next' } = options;
|
|
11
11
|
|
|
12
12
|
// Turbopack is used by Next.js, so we recommend using the Next.js integration
|
|
@@ -14,7 +14,7 @@ export function despiaOfflineTurbopack(options = {}) {
|
|
|
14
14
|
console.warn('⚠ Turbopack: Use @despia/local/next instead for Next.js projects');
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
|
-
name: 'despia-
|
|
17
|
+
name: 'despia-local-turbopack',
|
|
18
18
|
// Implementation would go here when Turbopack plugin API is stable
|
|
19
19
|
};
|
|
20
20
|
}
|
package/src/vite.js
CHANGED
|
@@ -11,11 +11,11 @@ import { generateManifest } from './core.js';
|
|
|
11
11
|
* @param {string} options.outDir - Output directory (default: 'dist')
|
|
12
12
|
* @param {string} options.entryHtml - Entry HTML file (default: 'index.html')
|
|
13
13
|
*/
|
|
14
|
-
export function
|
|
14
|
+
export function despiaLocalPlugin(options = {}) {
|
|
15
15
|
const { outDir = 'dist', entryHtml = 'index.html' } = options;
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
|
-
name: 'despia-
|
|
18
|
+
name: 'despia-local',
|
|
19
19
|
apply: 'build',
|
|
20
20
|
writeBundle(bundleOptions, bundle) {
|
|
21
21
|
const outputDir = bundleOptions.dir || outDir;
|
package/src/webpack.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { generateManifest } from './core.js';
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class DespiaLocalPlugin {
|
|
8
8
|
constructor(options = {}) {
|
|
9
9
|
this.options = {
|
|
10
10
|
outDir: options.outDir || 'dist',
|
|
@@ -14,7 +14,7 @@ class DespiaOfflinePlugin {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
apply(compiler) {
|
|
17
|
-
const pluginName = '
|
|
17
|
+
const pluginName = 'DespiaLocalPlugin';
|
|
18
18
|
|
|
19
19
|
compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback) => {
|
|
20
20
|
// Get output path from webpack compiler
|
|
@@ -53,4 +53,4 @@ class DespiaOfflinePlugin {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export default
|
|
56
|
+
export default DespiaLocalPlugin;
|