wrangler 0.0.2 → 0.0.6
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 +51 -55
- package/bin/wrangler.js +36 -0
- package/import_meta_url.js +3 -0
- package/miniflare-config-stubs/.env.empty +0 -0
- package/miniflare-config-stubs/package.empty.json +1 -0
- package/miniflare-config-stubs/wrangler.empty.toml +0 -0
- package/package.json +111 -9
- package/src/__tests__/clipboardy-mock.js +4 -0
- package/src/__tests__/index.test.ts +391 -0
- package/src/__tests__/jest.setup.ts +17 -0
- package/src/__tests__/mock-cfetch.js +42 -0
- package/src/__tests__/mock-dialogs.ts +65 -0
- package/src/api/form_data.ts +141 -0
- package/src/api/inspect.ts +430 -0
- package/src/api/preview.ts +128 -0
- package/src/api/worker.ts +161 -0
- package/src/cfetch.ts +72 -0
- package/src/cli.ts +10 -0
- package/src/config.ts +122 -0
- package/src/dev.tsx +867 -0
- package/src/dialogs.tsx +77 -0
- package/src/index.tsx +1875 -0
- package/src/kv.tsx +211 -0
- package/src/module-collection.ts +64 -0
- package/src/pages.tsx +818 -0
- package/src/proxy.ts +104 -0
- package/src/publish.ts +358 -0
- package/src/sites.tsx +115 -0
- package/src/tail.tsx +71 -0
- package/src/user.tsx +1029 -0
- package/static-asset-facade.js +47 -0
- package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +332 -0
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +176 -0
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +25 -0
- package/vendor/@cloudflare/kv-asset-handler/README.md +245 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +32 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/index.js +354 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +13 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +148 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +1 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +436 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +1 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +40 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +1 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +42 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +26 -0
- package/vendor/@cloudflare/kv-asset-handler/dist/types.js +31 -0
- package/vendor/@cloudflare/kv-asset-handler/package.json +52 -0
- package/vendor/@cloudflare/kv-asset-handler/src/index.ts +296 -0
- package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +136 -0
- package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +464 -0
- package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +33 -0
- package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +42 -0
- package/vendor/@cloudflare/kv-asset-handler/src/types.ts +39 -0
- package/vendor/wrangler-mime/CHANGELOG.md +289 -0
- package/vendor/wrangler-mime/LICENSE +21 -0
- package/vendor/wrangler-mime/Mime.js +97 -0
- package/vendor/wrangler-mime/README.md +187 -0
- package/vendor/wrangler-mime/cli.js +46 -0
- package/vendor/wrangler-mime/index.js +4 -0
- package/vendor/wrangler-mime/lite.js +4 -0
- package/vendor/wrangler-mime/package.json +52 -0
- package/vendor/wrangler-mime/types/other.js +1 -0
- package/vendor/wrangler-mime/types/standard.js +1 -0
- package/wrangler-dist/cli.js +125758 -0
- package/wrangler-dist/cli.js.map +7 -0
- package/.npmignore +0 -15
- package/index.js +0 -250
- package/tests/is.spec.js +0 -1155
package/.npmignore
DELETED
package/index.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
/* Wrangler -- convenience object for testing/casting certain types and
|
|
2
|
-
* smoothing out JavaScript weirdness like:
|
|
3
|
-
*
|
|
4
|
-
* undefined !== undefined
|
|
5
|
-
* typeof /regexp/ == 'object'
|
|
6
|
-
* typeof Nan == 'number'
|
|
7
|
-
*
|
|
8
|
-
* et cetera. Nothing earth-shattering, and it's certainly a bunch of rules we
|
|
9
|
-
* should all know; I just wanted to create something simple so I wouldn't have
|
|
10
|
-
* to keep remembering the rules. */
|
|
11
|
-
|
|
12
|
-
(function (exports) {
|
|
13
|
-
var toString = {}.toString,
|
|
14
|
-
toArray = [].slice,
|
|
15
|
-
hasOwnProperty = {}.hasOwnProperty,
|
|
16
|
-
is = {}, to = {};
|
|
17
|
-
|
|
18
|
-
/* --- is: type checking --- */
|
|
19
|
-
|
|
20
|
-
is.undefined = function isUndefined (value) {
|
|
21
|
-
return typeof value === 'undefined';
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
is.defined = function isUndefined (value) {
|
|
25
|
-
return typeof value !== 'undefined';
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
is.empty = function isEmpty (value) {
|
|
29
|
-
return value == null;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
is.empty.array = is.emptyArray = is.empty.arguments = is.emptyArguments = function isEmptyArray (value) {
|
|
33
|
-
return is.enumerable(value) && !is.string(value) && value.length === 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* is.empty.object() checks to see if value has any properties of its own.
|
|
37
|
-
* If it's not an object, returns undefined. */
|
|
38
|
-
is.empty.object = is.emptyObject = function isEmptyObject (value) {
|
|
39
|
-
var i, j = 0;
|
|
40
|
-
if (!is.object(value)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
for (i in value) {
|
|
44
|
-
if (value.hasOwnProperty(i)) {
|
|
45
|
-
j ++;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return !j;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
is.null = function isNull (value) {
|
|
52
|
-
return value === null;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
is.boolean = function isBoolean (value) {
|
|
56
|
-
return typeof value === 'boolean';
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
is.nan = function isNan (value) {
|
|
60
|
-
return typeof value === 'number' && isNaN(value);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
is.infinite = function isInfinite (value) {
|
|
64
|
-
return typeof value === 'number' && !isFinite(value) && !isNaN(value);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
is.number = function isNumber (value) {
|
|
68
|
-
return typeof value === 'number' && isFinite(value);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
is.integer = function isInteger (value) {
|
|
72
|
-
return value === (value | 0);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
is.float = function isFloat (value) {
|
|
76
|
-
return is.number(value) && value !== (value | 0);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
is.string = function isString (value) {
|
|
80
|
-
return typeof value === 'string';
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
is.object = function isObject (value) {
|
|
84
|
-
if (typeof value === 'object') {
|
|
85
|
-
if (value !== null) {
|
|
86
|
-
if (!(value instanceof RegExp)) {
|
|
87
|
-
if (!is.enumerable(value)) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
is.array = function isArray (value) {
|
|
97
|
-
return toString.call(value) === '[object Array]';
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/* is.enumerable()
|
|
101
|
-
* duck-types enumerable objects (arrays, array-like objects, and strings)
|
|
102
|
-
* to see if value has a numeric length property and is not a function
|
|
103
|
-
* (functions can have a length property, but it's used for the number of
|
|
104
|
-
* arguments, and therefore does not indicate enumerability) */
|
|
105
|
-
is.enumerable = function isEnumerable (value) {
|
|
106
|
-
return value != null // guard against trying to cast null to object
|
|
107
|
-
&& hasOwnProperty.call(value, 'length')
|
|
108
|
-
&& !is.function(value)
|
|
109
|
-
&& isFinite(value.length);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
is.arrayLike = function isArrayLike (value) {
|
|
113
|
-
return !is.string(value) && !is.array(value) && is.enumerable(value);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
is.arguments = function isArguments (value) {
|
|
117
|
-
return toString.call(value) === '[object Arguments]';
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
is.function = function isFunction (value) {
|
|
121
|
-
return toString.call(value) === '[object Function]';
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
is.regexp = function isRegexp (value) {
|
|
125
|
-
return toString.call(value) === '[object RegExp]';
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
is.date = function isDate (value) {
|
|
129
|
-
return toString.call(value) === '[object Date]';
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
is.in = function isIn (needle, haystack) {
|
|
133
|
-
var searchFunction;
|
|
134
|
-
if (haystack === undefined) {
|
|
135
|
-
haystack = this;
|
|
136
|
-
}
|
|
137
|
-
if (is.string(haystack)) {
|
|
138
|
-
searchFunction = is.inString;
|
|
139
|
-
} else if (is.arrayLike(haystack)) {
|
|
140
|
-
searchFunction = is.inArray;
|
|
141
|
-
} else {
|
|
142
|
-
searchFunction = is.inObject;
|
|
143
|
-
}
|
|
144
|
-
return searchFunction(needle, haystack);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
is.inArray = is.in.array = function isInArray (needle, haystack) {
|
|
148
|
-
var i;
|
|
149
|
-
if (haystack === undefined) {
|
|
150
|
-
// can be called; will work on this if haystack is undefined
|
|
151
|
-
if (is.arrayLike(this)) {
|
|
152
|
-
haystack = this;
|
|
153
|
-
} else {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (typeof Array.prototype.indexOf === 'function') {
|
|
158
|
-
return haystack.indexOf(needle) !== -1;
|
|
159
|
-
} else {
|
|
160
|
-
for (i = haystack.length; i >= 0; i --) {
|
|
161
|
-
if (haystack[i] === needle) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
is.inObject = is.in.object = function isInObject (needle, haystack) {
|
|
170
|
-
var i;
|
|
171
|
-
if (haystack === undefined) {
|
|
172
|
-
// can be called; will work on this if haystack is undefined
|
|
173
|
-
if (is.object(this)) {
|
|
174
|
-
haystack = this;
|
|
175
|
-
} else {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
for (i in haystack) {
|
|
180
|
-
if (haystack[i] === needle) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
is.ownProperty = function isOwnProperty (property, object) {
|
|
188
|
-
if (object === undefined) {
|
|
189
|
-
if (is.object(this)) {
|
|
190
|
-
object = this;
|
|
191
|
-
} else {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return hasOwnProperty.call(object, property);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
is.inString = is.in.string = function isInString (needle, haystack) {
|
|
199
|
-
if (typeof haystack !== 'string') {
|
|
200
|
-
haystack = toString.call(haystack);
|
|
201
|
-
}
|
|
202
|
-
return haystack.indexOf(needle) !== -1;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
is.jQuery = function isJQuery (value) {
|
|
206
|
-
return !is.undefined(jQuery) && value instanceof jQuery;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/* --- to: typecasting --- */
|
|
210
|
-
|
|
211
|
-
to.boolean = function toBoolean (value) {
|
|
212
|
-
return !!value;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
to.number = to.float = function toNumber (value) {
|
|
216
|
-
return parseFloat(value);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
to.integer = function toInteger (value) {
|
|
220
|
-
return parseInt(value, 10);
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
to.string = function tostring (value) {
|
|
224
|
-
return toString.call(value);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
to.array = function toarray (value) {
|
|
228
|
-
var prop, newValue = [];
|
|
229
|
-
if (is.array(value)) {
|
|
230
|
-
return value;
|
|
231
|
-
}
|
|
232
|
-
if (is.enumerable(value)) {
|
|
233
|
-
return toArray.call(value);
|
|
234
|
-
}
|
|
235
|
-
return [value];
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
to.regexp = function toRegexp (value) {
|
|
239
|
-
if (is.string(value)) {
|
|
240
|
-
return new RegExp(value);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
to.date = function toDate (value) {
|
|
245
|
-
return new Date(value);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
exports.is = is;
|
|
249
|
-
exports.to = to;
|
|
250
|
-
})(exports !== undefined ? exports : this);
|