jscrewit 2.37.0 → 2.38.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/Features.md +45 -28
- package/api-doc/README.md +15 -109
- package/api-doc/functions/encode.md +35 -0
- package/api-doc/interfaces/CustomFeature.md +47 -43
- package/api-doc/interfaces/ElementaryFeature.md +46 -42
- package/api-doc/interfaces/EncodeOptions.md +14 -19
- package/api-doc/interfaces/Feature.md +43 -40
- package/api-doc/interfaces/FeatureAll.md +409 -420
- package/api-doc/interfaces/FeatureConstructor.md +587 -593
- package/api-doc/interfaces/PredefinedFeature.md +48 -42
- package/api-doc/interfaces/default.md +8 -11
- package/api-doc/interfaces/encode.md +15 -18
- package/api-doc/type-aliases/ElementaryFeatureName.md +9 -0
- package/api-doc/type-aliases/FeatureElement.md +14 -0
- package/api-doc/type-aliases/FeatureElementOrCompatibleArray.md +16 -0
- package/api-doc/type-aliases/PredefinedFeatureName.md +9 -0
- package/api-doc/type-aliases/RunAs.md +10 -0
- package/api-doc/variables/Feature.md +7 -0
- package/api-doc/variables/default.md +7 -0
- package/lib/feature-all.d.ts +102 -36
- package/lib/feature.d.ts +6 -6
- package/lib/jscrewit.js +886 -186
- package/lib/jscrewit.min.js +2 -2
- package/package.json +4 -3
- package/readme.md +14 -17
- package/ui/ui.js +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
[**JScrewIt**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
1
5
|
# Interface: ElementaryFeature
|
|
2
6
|
|
|
3
7
|
Objects of this type indicate which of the capabilities that JScrewIt can use to minimize the
|
|
@@ -23,68 +27,52 @@ elementary features available in the current environment.
|
|
|
23
27
|
Not all features can be available at the same time: some features are necessarily incompatible,
|
|
24
28
|
meaning that they mutually exclude each other, and thus their union cannot be constructed.
|
|
25
29
|
|
|
26
|
-
##
|
|
30
|
+
## Extends
|
|
27
31
|
|
|
28
32
|
- [`PredefinedFeature`](PredefinedFeature.md)
|
|
29
33
|
|
|
30
|
-
↳ **`ElementaryFeature`**
|
|
31
|
-
|
|
32
|
-
## Table of contents
|
|
33
|
-
|
|
34
|
-
### Properties
|
|
35
|
-
|
|
36
|
-
- [canonicalNames](ElementaryFeature.md#canonicalnames)
|
|
37
|
-
- [elementary](ElementaryFeature.md#elementary)
|
|
38
|
-
- [elementaryNames](ElementaryFeature.md#elementarynames)
|
|
39
|
-
- [name](ElementaryFeature.md#name)
|
|
40
|
-
|
|
41
|
-
### Methods
|
|
42
|
-
|
|
43
|
-
- [includes](ElementaryFeature.md#includes)
|
|
44
|
-
- [restrict](ElementaryFeature.md#restrict)
|
|
45
|
-
|
|
46
34
|
## Properties
|
|
47
35
|
|
|
48
36
|
### canonicalNames
|
|
49
37
|
|
|
50
|
-
|
|
38
|
+
> `readonly` **canonicalNames**: [`ElementaryFeatureName`](../type-aliases/ElementaryFeatureName.md)[]
|
|
51
39
|
|
|
52
40
|
An array of all elementary feature names included in this feature object, without aliases and
|
|
53
41
|
implied features.
|
|
54
42
|
|
|
55
43
|
#### Inherited from
|
|
56
44
|
|
|
57
|
-
[PredefinedFeature](PredefinedFeature.md).[canonicalNames](PredefinedFeature.md#canonicalnames)
|
|
45
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`canonicalNames`](PredefinedFeature.md#canonicalnames)
|
|
58
46
|
|
|
59
|
-
|
|
47
|
+
***
|
|
60
48
|
|
|
61
49
|
### elementary
|
|
62
50
|
|
|
63
|
-
|
|
51
|
+
> `readonly` **elementary**: `true`
|
|
64
52
|
|
|
65
53
|
A boolean value indicating whether this is an elementary feature object.
|
|
66
54
|
|
|
67
55
|
#### Overrides
|
|
68
56
|
|
|
69
|
-
[PredefinedFeature](PredefinedFeature.md).[elementary](PredefinedFeature.md#elementary)
|
|
57
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`elementary`](PredefinedFeature.md#elementary)
|
|
70
58
|
|
|
71
|
-
|
|
59
|
+
***
|
|
72
60
|
|
|
73
61
|
### elementaryNames
|
|
74
62
|
|
|
75
|
-
|
|
63
|
+
> `readonly` **elementaryNames**: [`ElementaryFeatureName`](../type-aliases/ElementaryFeatureName.md)[]
|
|
76
64
|
|
|
77
65
|
An array of all elementary feature names included in this feature object, without aliases.
|
|
78
66
|
|
|
79
67
|
#### Inherited from
|
|
80
68
|
|
|
81
|
-
[PredefinedFeature](PredefinedFeature.md).[elementaryNames](PredefinedFeature.md#elementarynames)
|
|
69
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`elementaryNames`](PredefinedFeature.md#elementarynames)
|
|
82
70
|
|
|
83
|
-
|
|
71
|
+
***
|
|
84
72
|
|
|
85
73
|
### name
|
|
86
74
|
|
|
87
|
-
|
|
75
|
+
> `readonly` **name**: [`ElementaryFeatureName`](../type-aliases/ElementaryFeatureName.md)
|
|
88
76
|
|
|
89
77
|
The primary name of this feature object, useful for identification purpose.
|
|
90
78
|
|
|
@@ -93,21 +81,19 @@ If a name is assigned, it will be used when the feature is converted into a stri
|
|
|
93
81
|
|
|
94
82
|
#### Overrides
|
|
95
83
|
|
|
96
|
-
[PredefinedFeature](PredefinedFeature.md).[name](PredefinedFeature.md#name)
|
|
84
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`name`](PredefinedFeature.md#name)
|
|
97
85
|
|
|
98
86
|
## Methods
|
|
99
87
|
|
|
100
|
-
### includes
|
|
88
|
+
### includes()
|
|
101
89
|
|
|
102
|
-
|
|
90
|
+
> **includes**(...`features`): `boolean`
|
|
103
91
|
|
|
104
92
|
Determines whether this feature object includes all of the specified features.
|
|
105
93
|
|
|
106
94
|
#### Parameters
|
|
107
95
|
|
|
108
|
-
|
|
109
|
-
| :------ | :------ |
|
|
110
|
-
| `...features` | [`FeatureElementOrCompatibleArray`](../README.md#featureelementorcompatiblearray)[] |
|
|
96
|
+
• ...**features**: [`FeatureElementOrCompatibleArray`](../type-aliases/FeatureElementOrCompatibleArray.md)[]
|
|
111
97
|
|
|
112
98
|
#### Returns
|
|
113
99
|
|
|
@@ -118,13 +104,13 @@ If no arguments are specified, the return value is `true`.
|
|
|
118
104
|
|
|
119
105
|
#### Inherited from
|
|
120
106
|
|
|
121
|
-
[PredefinedFeature](PredefinedFeature.md).[includes](PredefinedFeature.md#includes)
|
|
107
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`includes`](PredefinedFeature.md#includes)
|
|
122
108
|
|
|
123
|
-
|
|
109
|
+
***
|
|
124
110
|
|
|
125
|
-
### restrict
|
|
111
|
+
### restrict()
|
|
126
112
|
|
|
127
|
-
|
|
113
|
+
> **restrict**(`environment`, `engineFeatureObjs`?): [`CustomFeature`](CustomFeature.md)
|
|
128
114
|
|
|
129
115
|
Creates a new feature object from this feature by removing elementary features that are not
|
|
130
116
|
available inside a particular environment.
|
|
@@ -134,10 +120,28 @@ that require strict mode code, or inside web workers.
|
|
|
134
120
|
|
|
135
121
|
#### Parameters
|
|
136
122
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
123
|
+
• **environment**: `"forced-strict-mode"` \| `"web-worker"`
|
|
124
|
+
|
|
125
|
+
The environment to which this feature should be restricted.
|
|
126
|
+
Two environments are currently supported.
|
|
127
|
+
|
|
128
|
+
<dl>
|
|
129
|
+
|
|
130
|
+
<dt><code>"forced-strict-mode"</code></dt>
|
|
131
|
+
<dd>
|
|
132
|
+
Removes features that are not available in environments that require strict mode code.
|
|
133
|
+
</dd>
|
|
134
|
+
|
|
135
|
+
<dt><code>"web-worker"</code></dt>
|
|
136
|
+
<dd>Removes features that are not available inside web workers.</dd>
|
|
137
|
+
|
|
138
|
+
</dl>
|
|
139
|
+
|
|
140
|
+
• **engineFeatureObjs?**: readonly [`PredefinedFeature`](PredefinedFeature.md)[]
|
|
141
|
+
|
|
142
|
+
An array of predefined feature objects, each corresponding to a particular engine in which
|
|
143
|
+
the restriction should be enacted.
|
|
144
|
+
If this parameter is omitted, the restriction is enacted in all engines.
|
|
141
145
|
|
|
142
146
|
#### Returns
|
|
143
147
|
|
|
@@ -145,4 +149,4 @@ that require strict mode code, or inside web workers.
|
|
|
145
149
|
|
|
146
150
|
#### Inherited from
|
|
147
151
|
|
|
148
|
-
[PredefinedFeature](PredefinedFeature.md).[restrict](PredefinedFeature.md#restrict)
|
|
152
|
+
[`PredefinedFeature`](PredefinedFeature.md).[`restrict`](PredefinedFeature.md#restrict)
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Table of contents
|
|
1
|
+
[**JScrewIt**](../README.md) • **Docs**
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
***
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
- [runAs](EncodeOptions.md#runas)
|
|
9
|
-
- [trimCode](EncodeOptions.md#trimcode)
|
|
10
|
-
- [wrapWith](EncodeOptions.md#wrapwith)
|
|
5
|
+
# Interface: EncodeOptions
|
|
11
6
|
|
|
12
7
|
## Properties
|
|
13
8
|
|
|
14
|
-
### features
|
|
9
|
+
### features?
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
> `optional` **features**: [`FeatureElementOrCompatibleArray`](../type-aliases/FeatureElementOrCompatibleArray.md)
|
|
17
12
|
|
|
18
13
|
Specifies the features available in the engines that evaluate the encoded output.
|
|
19
14
|
|
|
@@ -21,11 +16,11 @@ If this parameter is unspecified, [`JScrewIt.Feature.DEFAULT`](FeatureConstructo
|
|
|
21
16
|
the largest code.
|
|
22
17
|
To generate shorter code, specify all features available in all target engines explicitly.
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
***
|
|
25
20
|
|
|
26
|
-
### runAs
|
|
21
|
+
### runAs?
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
> `optional` **runAs**: [`RunAs`](../type-aliases/RunAs.md)
|
|
29
24
|
|
|
30
25
|
This option controls the type of code generated from the given input.
|
|
31
26
|
Allowed values are listed below.
|
|
@@ -74,11 +69,11 @@ plain string.
|
|
|
74
69
|
|
|
75
70
|
</dl>
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
***
|
|
78
73
|
|
|
79
|
-
### trimCode
|
|
74
|
+
### trimCode?
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
> `optional` **trimCode**: `boolean`
|
|
82
77
|
|
|
83
78
|
If this parameter is truthy, lines in the beginning and in the end of the file containing
|
|
84
79
|
nothing but space characters and JavaScript comments are removed from the generated output.
|
|
@@ -90,10 +85,10 @@ which are sometimes found in minified scripts.
|
|
|
90
85
|
Using this option may produce unexpected results if the input is not well-formed JavaScript
|
|
91
86
|
code.
|
|
92
87
|
|
|
93
|
-
|
|
88
|
+
***
|
|
94
89
|
|
|
95
|
-
### wrapWith
|
|
90
|
+
### wrapWith?
|
|
96
91
|
|
|
97
|
-
|
|
92
|
+
> `optional` **wrapWith**: [`RunAs`](../type-aliases/RunAs.md)
|
|
98
93
|
|
|
99
94
|
An alias for `runAs`.
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
[**JScrewIt**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
1
5
|
# Interface: Feature
|
|
2
6
|
|
|
3
7
|
Objects of this type indicate which of the capabilities that JScrewIt can use to minimize the
|
|
@@ -23,58 +27,41 @@ elementary features available in the current environment.
|
|
|
23
27
|
Not all features can be available at the same time: some features are necessarily incompatible,
|
|
24
28
|
meaning that they mutually exclude each other, and thus their union cannot be constructed.
|
|
25
29
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
- **`Feature`**
|
|
29
|
-
|
|
30
|
-
↳ [`CustomFeature`](CustomFeature.md)
|
|
31
|
-
|
|
32
|
-
↳ [`PredefinedFeature`](PredefinedFeature.md)
|
|
33
|
-
|
|
34
|
-
## Table of contents
|
|
35
|
-
|
|
36
|
-
### Properties
|
|
37
|
-
|
|
38
|
-
- [canonicalNames](Feature.md#canonicalnames)
|
|
39
|
-
- [elementary](Feature.md#elementary)
|
|
40
|
-
- [elementaryNames](Feature.md#elementarynames)
|
|
41
|
-
- [name](Feature.md#name)
|
|
30
|
+
## Extended by
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- [includes](Feature.md#includes)
|
|
46
|
-
- [restrict](Feature.md#restrict)
|
|
32
|
+
- [`CustomFeature`](CustomFeature.md)
|
|
33
|
+
- [`PredefinedFeature`](PredefinedFeature.md)
|
|
47
34
|
|
|
48
35
|
## Properties
|
|
49
36
|
|
|
50
37
|
### canonicalNames
|
|
51
38
|
|
|
52
|
-
|
|
39
|
+
> `readonly` **canonicalNames**: [`ElementaryFeatureName`](../type-aliases/ElementaryFeatureName.md)[]
|
|
53
40
|
|
|
54
41
|
An array of all elementary feature names included in this feature object, without aliases and
|
|
55
42
|
implied features.
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
***
|
|
58
45
|
|
|
59
46
|
### elementary
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
> `readonly` **elementary**: `boolean`
|
|
62
49
|
|
|
63
50
|
A boolean value indicating whether this is an elementary feature object.
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
***
|
|
66
53
|
|
|
67
54
|
### elementaryNames
|
|
68
55
|
|
|
69
|
-
|
|
56
|
+
> `readonly` **elementaryNames**: [`ElementaryFeatureName`](../type-aliases/ElementaryFeatureName.md)[]
|
|
70
57
|
|
|
71
58
|
An array of all elementary feature names included in this feature object, without aliases.
|
|
72
59
|
|
|
73
|
-
|
|
60
|
+
***
|
|
74
61
|
|
|
75
|
-
### name
|
|
62
|
+
### name?
|
|
76
63
|
|
|
77
|
-
|
|
64
|
+
> `optional` **name**: `string`
|
|
78
65
|
|
|
79
66
|
The primary name of this feature object, useful for identification purpose.
|
|
80
67
|
|
|
@@ -83,17 +70,15 @@ If a name is assigned, it will be used when the feature is converted into a stri
|
|
|
83
70
|
|
|
84
71
|
## Methods
|
|
85
72
|
|
|
86
|
-
### includes
|
|
73
|
+
### includes()
|
|
87
74
|
|
|
88
|
-
|
|
75
|
+
> **includes**(...`features`): `boolean`
|
|
89
76
|
|
|
90
77
|
Determines whether this feature object includes all of the specified features.
|
|
91
78
|
|
|
92
79
|
#### Parameters
|
|
93
80
|
|
|
94
|
-
|
|
95
|
-
| :------ | :------ |
|
|
96
|
-
| `...features` | [`FeatureElementOrCompatibleArray`](../README.md#featureelementorcompatiblearray)[] |
|
|
81
|
+
• ...**features**: [`FeatureElementOrCompatibleArray`](../type-aliases/FeatureElementOrCompatibleArray.md)[]
|
|
97
82
|
|
|
98
83
|
#### Returns
|
|
99
84
|
|
|
@@ -102,11 +87,11 @@ Determines whether this feature object includes all of the specified features.
|
|
|
102
87
|
`true` if this feature object includes all of the specified features; otherwise, `false`.
|
|
103
88
|
If no arguments are specified, the return value is `true`.
|
|
104
89
|
|
|
105
|
-
|
|
90
|
+
***
|
|
106
91
|
|
|
107
|
-
### restrict
|
|
92
|
+
### restrict()
|
|
108
93
|
|
|
109
|
-
|
|
94
|
+
> **restrict**(`environment`, `engineFeatureObjs`?): [`CustomFeature`](CustomFeature.md)
|
|
110
95
|
|
|
111
96
|
Creates a new feature object from this feature by removing elementary features that are not
|
|
112
97
|
available inside a particular environment.
|
|
@@ -116,10 +101,28 @@ that require strict mode code, or inside web workers.
|
|
|
116
101
|
|
|
117
102
|
#### Parameters
|
|
118
103
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
• **environment**: `"forced-strict-mode"` \| `"web-worker"`
|
|
105
|
+
|
|
106
|
+
The environment to which this feature should be restricted.
|
|
107
|
+
Two environments are currently supported.
|
|
108
|
+
|
|
109
|
+
<dl>
|
|
110
|
+
|
|
111
|
+
<dt><code>"forced-strict-mode"</code></dt>
|
|
112
|
+
<dd>
|
|
113
|
+
Removes features that are not available in environments that require strict mode code.
|
|
114
|
+
</dd>
|
|
115
|
+
|
|
116
|
+
<dt><code>"web-worker"</code></dt>
|
|
117
|
+
<dd>Removes features that are not available inside web workers.</dd>
|
|
118
|
+
|
|
119
|
+
</dl>
|
|
120
|
+
|
|
121
|
+
• **engineFeatureObjs?**: readonly [`PredefinedFeature`](PredefinedFeature.md)[]
|
|
122
|
+
|
|
123
|
+
An array of predefined feature objects, each corresponding to a particular engine in which
|
|
124
|
+
the restriction should be enacted.
|
|
125
|
+
If this parameter is omitted, the restriction is enacted in all engines.
|
|
123
126
|
|
|
124
127
|
#### Returns
|
|
125
128
|
|