@breakside/jskit 2026.10.0 → 2026.11.0
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/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSNodeHTTPClient.js +34 -14
- package/Frameworks/Foundation.jsframework/JS/JSNodeURLSessionDataTask.js +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSURLRequest.js +3 -0
- package/Frameworks/Foundation.jsframework/JS/JSZip.js +155 -1
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/Docs/DocClass.js +38 -1
- package/Node/Docs/DocComponent.js +26 -1
- package/Node/Docs/DocDictionaryProperty.js +8 -0
- package/Node/Docs/DocEnum.js +35 -2
- package/Node/Docs/DocEnumOption.js +3 -0
- package/Node/Docs/DocExtension.js +130 -0
- package/Node/Docs/DocFunction.js +8 -0
- package/Node/Docs/DocMethod.js +3 -0
- package/Node/Docs/DocProperty.js +11 -0
- package/Node/Docs/DocProtocol.js +4 -0
- package/Node/Docs/DocSpec.js +4 -0
- package/Node/Docs/DocSpecProperty.js +8 -0
- package/Node/Docs/DocTopicBasedComponent.js +75 -65
- package/Node/Documentation.js +73 -4
- package/Node/HTMLProjectServer.js +1 -1
- package/Node/Markdown.js +2 -2
- package/Node/io.breakside.jskit-bundle.js +3 -3
- package/Node/jskit +1 -0
- package/Resources/doc-default.css +2 -2
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSNodeHTTPClient.js +34 -14
- package/Root/Frameworks/Foundation/JSNodeURLSessionDataTask.js +2 -2
- package/Root/Frameworks/Foundation/JSURLRequest.js +3 -0
- package/Root/Frameworks/Foundation/JSZip.js +155 -1
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,10 @@ var https = require('https');
|
|
|
28
28
|
|
|
29
29
|
JSClass("JSNodeHTTPClient", JSObject, {
|
|
30
30
|
|
|
31
|
-
send: function(request, callbacks, target){
|
|
31
|
+
send: function(request, callbacks, target, allowedRedirects){
|
|
32
|
+
if (allowedRedirects === undefined){
|
|
33
|
+
allowedRedirects = 5;
|
|
34
|
+
}
|
|
32
35
|
var completed = false;
|
|
33
36
|
var complete = function(error){
|
|
34
37
|
if (completed){
|
|
@@ -41,6 +44,7 @@ JSClass("JSNodeHTTPClient", JSObject, {
|
|
|
41
44
|
};
|
|
42
45
|
try{
|
|
43
46
|
var response = null;
|
|
47
|
+
var client = this;
|
|
44
48
|
|
|
45
49
|
// Create node request
|
|
46
50
|
var options = {
|
|
@@ -66,20 +70,36 @@ JSClass("JSNodeHTTPClient", JSObject, {
|
|
|
66
70
|
}
|
|
67
71
|
response._headerMap.parse(rawHeaders.join("\r\n"));
|
|
68
72
|
response.statusText = message.statusMessage;
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
if (allowedRedirects > 0 && (response.statusCode === JSURLResponse.StatusCode.movedPermanently || response.statusCode === JSURLResponse.StatusCode.found)){
|
|
74
|
+
message.on('data', function(chunk){
|
|
75
|
+
});
|
|
76
|
+
message.on('end', function(){
|
|
77
|
+
if (completed){
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
request = request.redirectedRequestToURL(response.location);
|
|
81
|
+
if (callbacks.redirect){
|
|
82
|
+
callbacks.redirect(request);
|
|
83
|
+
}
|
|
84
|
+
client.send(request, callbacks, target, allowedRedirects - 1);
|
|
85
|
+
// TODO: send new request
|
|
86
|
+
});
|
|
87
|
+
}else{
|
|
88
|
+
if (callbacks.response){
|
|
89
|
+
callbacks.response.call(target, response);
|
|
79
90
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
var chunks = [];
|
|
92
|
+
message.on('data', function(chunk){
|
|
93
|
+
chunks.push(JSData.initWithNodeBuffer(chunk));
|
|
94
|
+
});
|
|
95
|
+
message.on('end', function(){
|
|
96
|
+
if (completed){
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
response.data = JSData.initWithChunks(chunks);
|
|
100
|
+
complete(null);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
83
103
|
});
|
|
84
104
|
nodeRequest.on('error', function(error){
|
|
85
105
|
complete(error);
|
|
@@ -38,8 +38,8 @@ JSClass("JSNodeURLSessionDataTask", JSURLSessionDataTask, {
|
|
|
38
38
|
}
|
|
39
39
|
if (this.cancelation === null){
|
|
40
40
|
this.cancelation = JSNodeHTTPClient.shared.send(this.currentRequest, {
|
|
41
|
-
redirect: function(
|
|
42
|
-
this._currentRequest =
|
|
41
|
+
redirect: function(request){
|
|
42
|
+
this._currentRequest = request;
|
|
43
43
|
},
|
|
44
44
|
uploadProgress: function(sent, total){
|
|
45
45
|
this.session._taskDidSendBodyData(this, sent, total);
|
|
@@ -46,6 +46,9 @@ JSClass("JSURLRequest", JSObject, {
|
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
redirectedRequestToURL: function(url){
|
|
49
|
+
if (!url.isAbsolute){
|
|
50
|
+
url.resolveToBaseURL(this.url);
|
|
51
|
+
}
|
|
49
52
|
var request = JSURLRequest.initWithURL(url);
|
|
50
53
|
request._method = this._method;
|
|
51
54
|
request._headerMap = this._headerMap;
|
|
@@ -11,9 +11,160 @@ JSClass("JSZip", JSObject, {
|
|
|
11
11
|
init: function(){
|
|
12
12
|
this.chunks = [];
|
|
13
13
|
this.directory = [];
|
|
14
|
+
this.directoryIndexByFilename = {};
|
|
14
15
|
this.offset = 0;
|
|
15
16
|
},
|
|
16
17
|
|
|
18
|
+
initWithData: function(data){
|
|
19
|
+
if (data === null || data === undefined){
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (data.length < 22){
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
this._data = data;
|
|
26
|
+
this.directory = [];
|
|
27
|
+
this.directoryIndexByFilename = {};
|
|
28
|
+
var offset = this._data.length - 22;
|
|
29
|
+
var minOffset = Math.max(0, offset - 0xFFFF);
|
|
30
|
+
while (offset >= minOffset && !(this._data[offset] === 0x50 && this._data[offset+1] === 0x4b && this._data[offset+2] === 0x05 && this._data[offset+3] === 0x06)){
|
|
31
|
+
offset -= 1;
|
|
32
|
+
}
|
|
33
|
+
if (offset < minOffset){
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
var end = this._data.subdataInRange(JSRange(offset, this._data.length - offset));
|
|
37
|
+
var dataView = end.dataView();
|
|
38
|
+
// End of Central Directory Record (APPNOTE.txt 4.3.16)
|
|
39
|
+
// everything is little-endian
|
|
40
|
+
var signature = dataView.getUint32(0, true);
|
|
41
|
+
if (signature !== 0x06054b50){
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
var diskNumber = dataView.getUint16(4, true);
|
|
45
|
+
var diskNumberWithDirectoryStart = dataView.getUint16(6, true);
|
|
46
|
+
var numberOfItemsOnDisk = dataView.getUint16(8, true);
|
|
47
|
+
var numberOfItemsTotal = dataView.getUint16(10, true);
|
|
48
|
+
var sizeOfDirectory = dataView.getUint32(12, true);
|
|
49
|
+
var offsetOfDirectoryStart = dataView.getUint32(16, true);
|
|
50
|
+
var commentLength = dataView.getUint16(20, true);
|
|
51
|
+
if (diskNumber !== 0 || diskNumberWithDirectoryStart !== 0){
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (offsetOfDirectoryStart + sizeOfDirectory > this._data.length){
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
var directory = this._data.subdataInRange(JSRange(offsetOfDirectoryStart, sizeOfDirectory));
|
|
58
|
+
dataView = directory.dataView();
|
|
59
|
+
var crc;
|
|
60
|
+
var compressedLength;
|
|
61
|
+
var uncompressedLength;
|
|
62
|
+
var nameLength;
|
|
63
|
+
var extraFieldLength;
|
|
64
|
+
var name;
|
|
65
|
+
var headerOffset;
|
|
66
|
+
var offset = 0;
|
|
67
|
+
for (var i = 0; i < numberOfItemsTotal; ++i){
|
|
68
|
+
// Central Directory File Header (APPNOTE.txt 4.3.12)
|
|
69
|
+
// Everything is little-endian
|
|
70
|
+
if (offset + 46 > sizeOfDirectory){
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
signature = dataView.getUint32(offset + 0, true);
|
|
74
|
+
if (signature !== 0x02014b50){
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
crc = dataView.getUint32(offset + 16, true);
|
|
78
|
+
compressedLength = dataView.getUint32(offset + 20, true);
|
|
79
|
+
uncompressedLength = dataView.getUint32(offset + 24, true);
|
|
80
|
+
nameLength = dataView.getUint16(offset + 28, true);
|
|
81
|
+
extraFieldLength = dataView.getUint16(offset + 30, true);
|
|
82
|
+
commentLength = dataView.getUint16(offset + 32, true);
|
|
83
|
+
headerOffset = dataView.getUint32(offset + 42, true);
|
|
84
|
+
if (offset + 46 + nameLength > sizeOfDirectory){
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
name = directory.subdataInRange(JSRange(offset + 46, nameLength)).stringByDecodingUTF8();
|
|
88
|
+
this.directory.push({
|
|
89
|
+
name: name,
|
|
90
|
+
offset: headerOffset,
|
|
91
|
+
header: this.data.subdataInRange(JSRange(headerOffset, 30 + nameLength + extraFieldLength)),
|
|
92
|
+
crc: crc,
|
|
93
|
+
compressedLength: compressedLength,
|
|
94
|
+
uncompressedLength: uncompressedLength
|
|
95
|
+
});
|
|
96
|
+
this.directoryIndexByFilename[name] = i;
|
|
97
|
+
offset += 46 + nameLength + extraFieldLength + commentLength;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
directoryIndexByFilename: null,
|
|
103
|
+
filenames: JSReadOnlyProperty(),
|
|
104
|
+
|
|
105
|
+
getFilenames: function(){
|
|
106
|
+
var filenames = [];
|
|
107
|
+
for (var i = 0, l = this.directory.length; i < l; ++i){
|
|
108
|
+
filenames.push(this.directory[i].name);
|
|
109
|
+
}
|
|
110
|
+
return filenames;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
dataForFilename: function(filename){
|
|
114
|
+
var index = this.directoryIndexByFilename[filename];
|
|
115
|
+
if (index === undefined){
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
var file = this.directory[index];
|
|
119
|
+
var dataView = file.header.dataView();
|
|
120
|
+
var signature = dataView.getUint32(0, true);
|
|
121
|
+
if (signature !== 0x04034b50){
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
var version = dataView.getUint16(4, true);
|
|
125
|
+
var flags = dataView.getUint16(6, true);
|
|
126
|
+
var method = dataView.getUint16(8, true);
|
|
127
|
+
var crc = dataView.getUint32(14, true);
|
|
128
|
+
var compressedLength = dataView.getUint32(18, true);
|
|
129
|
+
var uncompressedLength = dataView.getUint32(22, true);
|
|
130
|
+
var nameLength = dataView.getUint16(26, true);
|
|
131
|
+
var extraFieldLength = dataView.getUint16(28, true);
|
|
132
|
+
var offset = file.offset + 30 + nameLength + extraFieldLength;
|
|
133
|
+
if (version > 20){
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (method !== 8){
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if ((flags & 0x8) !== 0){
|
|
140
|
+
crc = file.crc;
|
|
141
|
+
compressedLength = file.compressedLength;
|
|
142
|
+
uncompressedLength = file.uncompressedLength;
|
|
143
|
+
}
|
|
144
|
+
if (offset + compressedLength > this.data.length){
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (compressedLength === 0 || uncompressedLength === 0){
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
var compressedData = this.data.subdataInRange(JSRange(offset, compressedLength));
|
|
151
|
+
var data = JSData.initWithLength(uncompressedLength);
|
|
152
|
+
var stream = DeflateStream();
|
|
153
|
+
stream.input = compressedData;
|
|
154
|
+
stream.output = data;
|
|
155
|
+
stream.inflate(true);
|
|
156
|
+
if (stream.state !== DeflateStream.State.done){
|
|
157
|
+
data = null;
|
|
158
|
+
}
|
|
159
|
+
if (data === null){
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (JSCRC32(data) !== crc){
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return data;
|
|
166
|
+
},
|
|
167
|
+
|
|
17
168
|
offset: 0,
|
|
18
169
|
|
|
19
170
|
addFile: function(file, completion, target){
|
|
@@ -83,7 +234,10 @@ JSClass("JSZip", JSObject, {
|
|
|
83
234
|
this.directory.push({
|
|
84
235
|
name: name,
|
|
85
236
|
offset: this.offset,
|
|
86
|
-
header: header
|
|
237
|
+
header: header,
|
|
238
|
+
crc: crc,
|
|
239
|
+
compressedLength: storedData.length,
|
|
240
|
+
uncompressedLength: data.length
|
|
87
241
|
});
|
|
88
242
|
this.chunks.push(header);
|
|
89
243
|
this.chunks.push(storedData);
|