@divriots/jampack 0.23.0 → 0.23.2

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 CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -9,6 +9,7 @@ export async function compressCSS(originalCode, type) {
9
9
  code: originalCode,
10
10
  minify: true,
11
11
  sourceMap: false,
12
+ targets,
12
13
  };
13
14
  if (type === 'inline') {
14
15
  lightCSSData = lightcssStyleAttribute(options).code;
@@ -16,7 +17,6 @@ export async function compressCSS(originalCode, type) {
16
17
  else {
17
18
  lightCSSData = lightcss({
18
19
  filename: 'style.css',
19
- targets,
20
20
  ...options,
21
21
  }).code;
22
22
  }
package/dist/index.js CHANGED
File without changes
@@ -1,26 +1,25 @@
1
1
  import $state from '../state.js';
2
2
  import * as fs from 'fs/promises';
3
3
  import * as path from 'path';
4
- import * as url from 'url';
4
+ import { createRequire } from 'node:module';
5
+ const require = createRequire(import.meta.url);
5
6
  const src_filename = 'quicklink.mjs';
6
7
  const folder = `/_jampack/quicklink-2.3.0`;
7
8
  const url_loader = `${folder}/loader.js`;
8
- const url_quicklink = `${folder}/${src_filename}`;
9
- let payloadStored = false;
10
9
  export async function prefetch_links_in_viewport(html_file) {
11
10
  const path_html = path.dirname('/' + html_file);
11
+ const quickLinkDestination = path.join($state.dir, folder, src_filename);
12
+ const payloadStored = await fs.access(quickLinkDestination).catch(() => false);
12
13
  if (!payloadStored) {
13
14
  const path_loader = path.join($state.dir, url_loader);
14
15
  await fs.mkdir(path.join($state.dir, folder), { recursive: true });
15
16
  // Write loader
16
- const code_loader = `import { listen } from "./quicklink.mjs";
17
+ const code_loader = `import { listen } from "./${src_filename}";
17
18
  listen();`;
18
19
  await fs.writeFile(path_loader, code_loader);
19
20
  // Write quicklink code
20
- const source = path.join(path.dirname(url.fileURLToPath(import.meta.url)), `../../node_modules/quicklink/dist/${src_filename}`);
21
- await fs.copyFile(source, path.join($state.dir, folder, src_filename));
22
- // We don't need to store them anymore
23
- payloadStored = true;
21
+ const source = require.resolve(`quicklink/dist/${src_filename}`);
22
+ await fs.copyFile(source, quickLinkDestination);
24
23
  }
25
24
  return `<script type="module" src="${path.relative(path_html, url_loader)}"></script>`;
26
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "cache-version": {
5
5
  "img": "v1",
6
6
  "img-ext": "v1"
@@ -58,18 +58,17 @@
58
58
  "tslib": "^2.6.2",
59
59
  "typescript": "^5.3.3"
60
60
  },
61
+ "engines": {
62
+ "node": ">=14.0.0"
63
+ },
64
+ "bugs": "https://github.com/divriots/jampack/issues",
65
+ "keywords": [],
66
+ "types": "dist/index.d.ts",
61
67
  "scripts": {
62
68
  "watch": "pnpm build --watch",
63
69
  "try": "shx rm -fr demo && cp -R demo_drc demo && node ./dist/index.js ./demo --nocache",
64
70
  "build": "shx rm -rf dist && tsc -b",
65
71
  "lint": "eslint . --ext .ts --config .eslintrc",
66
- "prepublishOnly": "pnpm build",
67
72
  "cleanAllDotJampack": "find -s . | grep '.jampack$' | xargs rm -fr"
68
- },
69
- "engines": {
70
- "node": ">=14.0.0"
71
- },
72
- "bugs": "https://github.com/divriots/jampack/issues",
73
- "keywords": [],
74
- "types": "dist/index.d.ts"
75
- }
73
+ }
74
+ }