npm-pkgbuild 10.14.0 → 10.14.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "10.14.0",
3
+ "version": "10.14.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -45,7 +45,7 @@
45
45
  "aggregate-async-iterator": "^1.1.14",
46
46
  "commander": "^9.4.0",
47
47
  "content-entry": "^5.1.1",
48
- "content-entry-filesystem": "^5.2.0",
48
+ "content-entry-filesystem": "^5.2.1",
49
49
  "content-entry-transform": "^1.4.11",
50
50
  "execa": "^6.1.0",
51
51
  "expression-expander": "^7.0.19",
@@ -107,7 +107,7 @@ export function shrinkNPM(pkg, options = { removeKeys: nameAndVersion, removeDef
107
107
  delete pkg[key];
108
108
  });
109
109
 
110
- if (options && options.removeKeys) {
110
+ if (options?.removeKeys) {
111
111
  options.removeKeys.map(key => {
112
112
  delete pkg[key];
113
113
  });
@@ -49,7 +49,7 @@ export const pkgKeyValuePairOptions = {
49
49
 
50
50
  function keyPrefix(key) {
51
51
  const f = fields[key];
52
- return f && f.prefix ? f.prefix + key : key;
52
+ return f?.prefix ? f.prefix + key : key;
53
53
  }
54
54
 
55
55
  const PKGBUILD = "PKGBUILD";
@@ -10,10 +10,16 @@ const MEDIA_TYPE_MANIFEST = "application/vnd.oci.image.manifest.v1+json";
10
10
  const MEDIA_TYPE_CONFIG = "application/vnd.oci.image.config.v1+json";
11
11
  const MEDI_TYPE_IMAGE_LAYER = "application/vnd.oci.image.layer.v1.tar+gzip";
12
12
 
13
- function into(buffer, offset, string) {
14
- for (let i = 0; i < string.length; i++) {
13
+ function into(buffer, offset, length, string) {
14
+ let i = 0;
15
+
16
+ for (; i < string.length; i++) {
15
17
  buffer[offset + i] = string.charCodeAt(i);
16
18
  }
19
+
20
+ for (; i < length; i++) {
21
+ buffer[offset + i] = 0;
22
+ }
17
23
  }
18
24
 
19
25
  function intoOctal(buffer, offset, length, number) {
@@ -91,15 +97,15 @@ export class OCI extends Packager {
91
97
  console.log(packageFile);
92
98
 
93
99
  const header = new Uint8Array(512);
94
- into(header, 257, "ustar");
100
+ into(header, 257, 6, "ustar");
95
101
  header[263] = 48; // 0;
96
102
  header[264] = 48; // 0;
97
103
 
98
104
  intoOctal(header, 108, 8, 0 /* root */);
99
105
  intoOctal(header, 116, 8, 3 /* sys */);
100
106
 
101
- into(header, 265, "root");
102
- into(header, 297, "sys");
107
+ into(header, 265, 32, "root");
108
+ into(header, 297, 32, "sys");
103
109
 
104
110
  header[156] = 48; // 0
105
111
 
@@ -108,10 +114,12 @@ export class OCI extends Packager {
108
114
  const buffer = await entry.buffer;
109
115
  const size = buffer.length;
110
116
 
111
- into(header, 0, entry.name);
117
+ into(header, 0,100, entry.name);
112
118
  intoOctal(header, 100, 8, entry.mode);
113
119
  intoOctal(header, 124, 12, size);
114
- intoOctal(header, 136, 12, await entry.mtime);
120
+
121
+ const mtime = await entry.mtime;
122
+ intoOctal(header, 136, 12, mtime ? mtime.getTime() / 1000: 0);
115
123
  intoOctal(header, 148, 8, chksum(header));
116
124
 
117
125
  out.write(header);
@@ -92,7 +92,7 @@ export class Packager {
92
92
  out[nd[0]] = nd[1];
93
93
  }
94
94
 
95
- if (options.publish && options.publish.length) {
95
+ if (options.publish?.length) {
96
96
  const publish = analysePublish(options.publish[0], out.properties);
97
97
 
98
98
  out.destination = publish.scheme === "file:" ? publish.url : tmpdir;