Skip to content

Commit

Permalink
Update build and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Aug 16, 2022
1 parent a2524a1 commit e85dde6
Show file tree
Hide file tree
Showing 22 changed files with 269 additions and 200 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/JScrewIt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: 18 >=18.1
- run: |
npm install --workspaces
npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/~feature-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: 18 >=18.1
- run: |
npm install --prefix ../..
npm run lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/~result-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: 18 >=18.1
- run: |
npm install --prefix ../..
npm run lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/~solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: 18 >=18.1
- run: |
npm install --prefix ../..
npm run lint
Expand Down
88 changes: 76 additions & 12 deletions api-doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- [default](interfaces/default.md)
- [encode](interfaces/encode.md)

### Type aliases
### Type Aliases

- [ElementaryFeatureName](README.md#elementaryfeaturename)
- [FeatureElement](README.md#featureelement)
Expand All @@ -24,11 +24,14 @@

### Variables

- [Feature](README.md#feature)
- [default](README.md#default)

### Functions

- [Feature](README.md#feature)
- [encode](README.md#encode)

## Type aliases
## Type Aliases

### ElementaryFeatureName

Expand All @@ -44,7 +47,7 @@ ___

A feature object or a name or alias of a predefined feature.

**`remarks`**
**`Remarks`**

Methods that accept parameters of this type throw an error if the specified value is neither a
feature object nor a name or alias of a predefined feature.
Expand All @@ -58,7 +61,7 @@ ___
A feature object, a name or alias of a predefined feature, or an array of such values that
defines a union of mutually compatible features.

**`remarks`**
**`Remarks`**

Methods that accept parameters of this type throw an error if the specified value is neither a
feature object nor a name or alias of a predefined feature, or if it is an array of values that
Expand All @@ -79,24 +82,85 @@ ___
Ƭ **RunAs**: ``"call"`` \| ``"eval"`` \| ``"express"`` \| ``"express-call"`` \| ``"express-eval"`` \| ``"none"``

Values of this type control the type of code generated from a given input.
See <code>[EncodeOptions.runAs](interfaces/EncodeOptions.md#runas)</code> for the meaning of each possible value.
See [`EncodeOptions.runAs`](interfaces/EncodeOptions.md#runas) for the meaning of each possible value.

## Variables

### default

**default**: [`default`](README.md#default)

## Functions

### Feature

**Feature**: [`FeatureConstructor`](interfaces/FeatureConstructor.md)
**Feature**(...`features`): [`CustomFeature`](interfaces/CustomFeature.md)

___
Creates a new feature object from the union of the specified features.

### default
The constructor can be used with or without the `new` operator, e.g.
`new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`.
If no arguments are specified, the new feature object will be equivalent to
[`DEFAULT`](interfaces/FeatureConstructor.md#default).

**default**: [`default`](README.md#default)
**`Example`**

The following statements are equivalent, and will all construct a new feature object
including both [`ANY_DOCUMENT`](interfaces/FeatureConstructor.md#any_document) and [`ANY_WINDOW`](interfaces/FeatureConstructor.md#any_window).

```js
new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW");
```

```js
new JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW);
```

JScrewIt object, available in Node.js.
```js
new JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]);
```

**`Throws`**

An error is thrown if any of the specified features are not mutually compatible.

#### Parameters

| Name | Type |
| :------ | :------ |
| `...features` | [`FeatureElementOrCompatibleArray`](README.md#featureelementorcompatiblearray)[] |

#### Returns

[`CustomFeature`](interfaces/CustomFeature.md)

___

### encode

**encode**: [`encode`](README.md#encode)
**encode**(`input`, `options?`): `string`

Encodes a given string into JSFuck.

**`Throws`**

An `Error` is thrown under the following circumstances.
- The specified string cannot be encoded with the specified options.
- Some unknown features were specified.
- A combination of mutually incompatible features was specified.
- The option `runAs` (or `wrapWith`) was specified with an invalid value.

Also, an out of memory condition may occur when processing very large data.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` | The string to encode. |
| `options?` | [`EncodeOptions`](interfaces/EncodeOptions.md) | An optional object specifying encoding options. |

#### Returns

`string`

The encoded string.
4 changes: 2 additions & 2 deletions api-doc/interfaces/EncodeOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

Specifies the features available in the engines that evaluate the encoded output.

If this parameter is unspecified, [`JScrewIt.Feature.DEFAULT`](FeatureConstructor.md#default) is assumed: this
ensures maximum compatibility but also generates the largest code.
If this parameter is unspecified, [`JScrewIt.Feature.DEFAULT`](FeatureConstructor.md#default) is assumed: this ensures maximum compatibility but also generates
the largest code.
To generate shorter code, specify all features available in all target engines explicitly.

___
Expand Down
11 changes: 5 additions & 6 deletions api-doc/interfaces/Feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Objects of this type indicate which of the capabilities that JScrewIt can use to
length of its output are available in a particular JavaScript engine.

JScrewIt comes with a set of predefined feature objects exposed as property values of
`JScrewIt.Feature` or [`JScrewIt.Feature.ALL`](FeatureConstructor.md#all), where the property name is the feature's
name or alias.
`JScrewIt.Feature` or [`JScrewIt.Feature.ALL`](FeatureConstructor.md#all), where the property
name is the feature's name or alias.

Besides these predefined features, it is possible to construct custom features from the union or
intersection of other features.
Expand All @@ -16,10 +16,9 @@ they are different from such a union in that they exclude some other feature not
their elementary components.
All other features, called *composite* features, can be constructed as a union of zero or more
elementary features.
Two of the predefined composite features are particularly important: <code>[DEFAULT](FeatureConstructor.md#default)</code> is
the empty feature, indicating that no elementary feature is available at all;
<code>[AUTO](FeatureConstructor.md#auto)</code> is the union of all elementary features available in the current
environment.
Two of the predefined composite features are particularly important: [`DEFAULT`](FeatureConstructor.md#default) is the empty feature, indicating that no elementary
feature is available at all; [`AUTO`](FeatureConstructor.md#auto) is the union of all
elementary features available in the current environment.

Not all features can be available at the same time: some features are necessarily incompatible,
meaning that they mutually exclude each other, and thus their union cannot be constructed.
Expand Down
Loading

0 comments on commit e85dde6

Please sign in to comment.