extwee 2.2.5 → 2.3.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.
Files changed (63) hide show
  1. package/.github/workflows/dependabot-automerge.yml +23 -0
  2. package/.github/workflows/nodejs.yml +4 -1
  3. package/README.md +29 -14
  4. package/SECURITY.md +1 -1
  5. package/build/extwee.web.min.js +2 -0
  6. package/build/extwee.web.min.js.LICENSE.txt +1 -0
  7. package/extwee.config.json +6 -0
  8. package/extwee.config.md +67 -0
  9. package/index.js +2 -0
  10. package/package.json +24 -23
  11. package/src/CLI/CommandLineProcessing.js +196 -0
  12. package/src/CLI/ProcessConfig/loadStoryFormat.js +102 -0
  13. package/src/CLI/ProcessConfig/readDirectories.js +46 -0
  14. package/src/CLI/ProcessConfig.js +175 -0
  15. package/src/CLI/isDirectory.js +27 -0
  16. package/src/CLI/isFile.js +28 -0
  17. package/src/Config/parser.js +30 -8
  18. package/src/Passage.js +17 -2
  19. package/src/Story.js +101 -1
  20. package/src/StoryFormat/compile.js +19 -0
  21. package/src/StoryFormat.js +51 -0
  22. package/src/extwee.js +20 -195
  23. package/test/Config/Config.test.js +40 -10
  24. package/test/Config/files/full.json +8 -0
  25. package/test/Config/files/valid.json +4 -3
  26. package/test/Config/isDirectory.test.js +44 -0
  27. package/test/Config/isFile.test.js +50 -0
  28. package/test/Config/loadStoryFormat.test.js +101 -0
  29. package/test/Config/readDirectories.test.js +68 -0
  30. package/test/Objects/Passage.test.js +5 -0
  31. package/test/Objects/Story.test.js +174 -0
  32. package/test/Objects/StoryFormat.test.js +60 -0
  33. package/test/TWS/Parse.test.js +0 -22
  34. package/test/Web/window.Extwee.test.js +85 -0
  35. package/types/Story.d.ts +26 -1
  36. package/types/StoryFormat/compile.d.ts +8 -0
  37. package/types/StoryFormat.d.ts +7 -0
  38. package/types/index.d.ts +4 -2
  39. package/types/src/CLI/CommandLineProcessing.d.ts +8 -0
  40. package/types/src/CLI/ProcessConfig/loadStoryFormat.d.ts +20 -0
  41. package/types/src/CLI/ProcessConfig/readDirectories.d.ts +9 -0
  42. package/types/src/CLI/ProcessConfig.d.ts +12 -0
  43. package/types/src/CLI/isDirectory.d.ts +1 -0
  44. package/types/src/CLI/isFile.d.ts +1 -0
  45. package/types/src/Config/parser.d.ts +6 -0
  46. package/types/src/Config/reader.d.ts +11 -0
  47. package/types/src/IFID/generate.d.ts +14 -0
  48. package/types/src/JSON/parse.d.ts +44 -1
  49. package/types/src/Passage.d.ts +49 -4
  50. package/types/src/Story.d.ts +110 -16
  51. package/types/src/StoryFormat/compile.d.ts +8 -0
  52. package/types/src/StoryFormat/parse.d.ts +46 -3
  53. package/types/src/StoryFormat.d.ts +69 -38
  54. package/types/src/TWS/parse.d.ts +3 -3
  55. package/types/src/Twee/parse.d.ts +3 -4
  56. package/types/src/Twine1HTML/compile.d.ts +3 -1
  57. package/types/src/Twine1HTML/parse.d.ts +3 -4
  58. package/types/src/Twine2ArchiveHTML/compile.d.ts +8 -0
  59. package/types/src/Twine2ArchiveHTML/parse.d.ts +31 -1
  60. package/types/src/Twine2HTML/compile.d.ts +7 -2
  61. package/types/src/Twine2HTML/parse.d.ts +12 -9
  62. package/index.html +0 -22
  63. package/test/TWS/TWSParser/Example1.tws +0 -150
@@ -0,0 +1,23 @@
1
+ name: Dependabot auto-merge
2
+ on: pull_request
3
+
4
+ permissions:
5
+ contents: write
6
+ pull-requests: write
7
+
8
+ jobs:
9
+ dependabot:
10
+ runs-on: ubuntu-latest
11
+ if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'videlais/extwee'
12
+ steps:
13
+ - name: Dependabot metadata
14
+ id: metadata
15
+ uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7
16
+ with:
17
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
18
+ - name: Enable auto-merge for Dependabot PRs
19
+ if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
20
+ run: gh pr merge --auto --merge "$PR_URL"
21
+ env:
22
+ PR_URL: ${{github.event.pull_request.html_url}}
23
+ GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -2,6 +2,9 @@ name: Node CI
2
2
 
3
3
  on: [push]
4
4
 
5
+ permissions:
6
+ contents: read
7
+
5
8
  jobs:
6
9
  build:
7
10
 
@@ -9,7 +12,7 @@ jobs:
9
12
 
10
13
  strategy:
11
14
  matrix:
12
- node-version: [20.x]
15
+ node-version: [23.x]
13
16
 
14
17
  steps:
15
18
  - uses: actions/checkout@v4
package/README.md CHANGED
@@ -21,13 +21,14 @@
21
21
  </ol>
22
22
  <li><a href="#documentation">Documentation</a></li>
23
23
  <li><a href="#command-line-usage">Command-Line Usage</a></li>
24
+ <li><a href="#config-file-usage">Config File Usage</a></li>
24
25
  <li><a href="#escaping- meta-characters">Escaping Meta-Characters</a></li>
25
26
  <li><a href="#license">License</a></li>
26
27
  </ol>
27
28
 
28
29
  ## Story Compilation
29
30
 
30
- The process of *story compilation* converts human-readable content, what is generally called a *story*, into a playable format such as HyperText Markup Language (HTML). The result is then presented as links or other visual, interactive elements for another party to interact with to see its content.
31
+ The process of *story compilation* converts human-readable content, what is generally called a *story*, into a playable format such as HyperText Markup Language (HTML). The result is then presented as links or other visual, interactive elements for another party.
31
32
 
32
33
  The term *compilation* is used because different parts of code are put together in a specific arrangement to enable later play. As part of Twine-compatible HTML, this means combining JavaScript code (generally a "story format") with story HTML data.
33
34
 
@@ -59,12 +60,13 @@ Extwee supports multiple historical and current Twine-compatible formats.
59
60
 
60
61
  | Format | Input | Output |
61
62
  |----------------------------------------------------------------------------------------------------------------------------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
62
- | [ Twine 1 HTML (2006 - 2015) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md ) | Yes | Partial support. Twine 1 HTML can be produced, but the `StorySettings` optional passage introduced in Twine 1.4.0 requires external libraries like jQuery not included with Extwee. |
63
- | [ Twine 1 TWS (2009 - 2015) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-twsoutput.md ) | Yes | Extwee does not support TWS (Python pickle) output because no current version of Twine or other story compilation tool produces this historical format. |
64
- | [ Twine 2 HTML (2015 - Present) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md ) | Yes | Yes |
65
- | [ Twine 2 Archive HTML (2015 - Present) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-archive-spec.md ) | Yes | Yes |
66
- | [ Twee 3 (2021 - Present) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md ) | Yes | Yes |
67
- | [ Twine 2 JSON (2023 - Present) ]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-jsonoutput-doc.md ) | Yes | Yes |
63
+ | [Twine 1 HTML (2006 - 2015)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-htmloutput-doc.md ) | Yes | Partial support. Twine 1 HTML can be produced, but the `StorySettings` optional passage introduced in Twine 1.4.0 requires external libraries like jQuery not included with Extwee. |
64
+ | [Twine 1 TWS (2009 - 2015)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-1-twsoutput.md ) | Yes | Extwee does not support TWS (Python pickle) output because no current version of Twine or other story compilation tool produces this historical format. |
65
+ | [Twine 2 HTML (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-htmloutput-spec.md ) | Yes | Yes |
66
+ | [Twine 2 Archive HTML (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-archive-spec.md ) | Yes | Yes |
67
+ | [Twee 3 (2021 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md ) | Yes | Yes |
68
+ | [Twine 2 JSON (2023 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-jsonoutput-doc.md ) | Yes | Yes |
69
+ | [Twine 2 Story Format (2015 - Present)]( https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-storyformats-spec.md ) | Yes | Yes |
68
70
 
69
71
  **Note:** Round-trip translations can present problems because of required fields and properties per format. Some metadata may be added or removed based on the specification being followed.
70
72
 
@@ -86,6 +88,8 @@ An object must be created using either the `new` keyword in JavaScript or as the
86
88
 
87
89
  Story and Passage objects can generate multiple output formats: `toTwee()`, `toTwine1HTML()`, `toTwine2HTML()`, and `toJSON()`. Stories cannot be played in a browser without the corresponding compiler combining it with story format data.
88
90
 
91
+ The StoryFormat object supports `toString()` method of producing a tab-separated JSON output and `toJSON()` method of generating JSON output matching the Twine 2 Story Format Specification.
92
+
89
93
  <p align="right">(<a href="#readme-top">back to top</a>)</p>
90
94
 
91
95
  ### Parsers
@@ -110,8 +114,11 @@ Compiles story, story formats, or other data into an archive or playable format.
110
114
  - `compileTwine2HTML()`
111
115
  - `compileTwine1HTML()`
112
116
  - `compileTwine2ArchiveHTML()`
117
+ - `compileStoryFormat()`
118
+
119
+ To create playable Twine 1 HTML, an `engine.js` file must be supplied. (See [Story Format Archive](https://github.com/videlais/story-formats-archive/tree/main/official/twine1/engine/1.4.2) for available Twine 1 `engine.js` file.)
113
120
 
114
- **Note:** In order to create playable Twine 1 HTML, an `engine.js` file must be supplied.
121
+ Compilation of a story format adds the necessary function wrapper to convert the JSON output, via `toJSON()`, to JSONP.
115
122
 
116
123
  ### Support Functionality
117
124
 
@@ -129,7 +136,9 @@ Extwee has [documentation hosted on GitHub Pages](https://videlais.github.io/ext
129
136
 
130
137
  ## Command-Line Usage
131
138
 
132
- Extwee supports a command-line interface for four general scenarios:
139
+ Extwee supports a command-line interface for four general scenarios.
140
+
141
+ **Notes:** As of Extwee 2.2.5, short and long command-line option flags are separated. Short options use one hyphen followed by one character and all long options begin with two hyphens and a name as word.
133
142
 
134
143
  ### Compiling Twee 3 + Twine 2 Story Format into Twine 2 HTML
135
144
 
@@ -145,10 +154,12 @@ De-compile Twine 2 HTML into Twee 3:
145
154
 
146
155
  ### Compiling Twee 3 into Twine 1 HTML
147
156
 
148
- Enabling Twine 1 mode requires using the `--twine1` flag.
157
+ Enabling Twine 1 mode requires using the `--twine1` long flag.
149
158
 
150
159
  Because Twine 1 story formats can be split across files, compilation requires the "engine" from Twine 1 named `engine.js`, the name of the story format, and then its `header.html` template code and the optional but often included `code.js` file.
151
160
 
161
+ (Refer to the [Story Formats Archive](https://github.com/videlais/story-formats-archive) for access to historic `engine.js` and other files.)
162
+
152
163
  `extwee --twine1 -c -i <tweeFile> -o <Twine1HTML> --engine <engineJS> --name <storyFormatName> --codejs <CodeJS> --header <header>`
153
164
 
154
165
  ### De-compiling Twine 1 HTML into Twee 3
@@ -159,15 +170,19 @@ Enabling Twine 1 mode requires using the `--twine1` flag.
159
170
 
160
171
  <p align="right">(<a href="#readme-top">back to top</a>)</p>
161
172
 
162
- ## Roadmap
173
+ ## Config File Usage
174
+
175
+ When invoked from its command-line interface using `npx extwee`, it will look for a `extwee.config.json` file in the local directory. If found, and its fields are valid, processing will use the values found in the file.
163
176
 
164
- Each major version has its own GitHub project:
177
+ Consult the possible options in its [dedicated file](extwee.config.md).
165
178
 
166
- - [Road to Extwee 2.4.0](https://github.com/users/videlais/projects/4)
179
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
167
180
 
168
181
  ## Tree Shaking Support
169
182
 
170
- For [advanced tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) patterns, most formats are broke into `compile.js` and `parse.js` files exporting associated `compile()` and `parse()` functions. When using the API, it is possible to only import a single function or object to produce smaller and potentially faster code in projects dependent on Extwee functionality.
183
+ For [advanced tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) patterns, most formats are broke into `compile.js` and `parse.js` files exporting associated `compile()` and `parse()` functions.
184
+
185
+ When using the API, it is possible to only import a single function or object to produce smaller and potentially faster code in projects dependent on Extwee functionality.
171
186
 
172
187
  <p align="right">(<a href="#readme-top">back to top</a>)</p>
173
188
 
package/SECURITY.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Version | Supported |
6
6
  | ------- | ------------------ |
7
7
  | 1.6 | :x: |
8
- | 2.2 | :white_check_mark: |
8
+ | 2.X | :white_check_mark: |
9
9
 
10
10
  ## Reporting a Vulnerability
11
11