extwee 2.2.4 → 2.2.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 +26 -21
- package/eslint.config.js +7 -1
- package/index.js +2 -0
- package/package.json +22 -20
- package/src/Config/parser.js +36 -0
- package/src/Config/reader.js +34 -0
- package/src/Story.js +10 -1
- package/src/StoryFormat/compile.js +19 -0
- package/src/StoryFormat.js +51 -0
- package/src/TWS/parse.js +1 -2
- package/src/extwee.js +6 -6
- package/test/CLI/CLI.test.js +2 -2
- package/test/Config/Config.test.js +46 -0
- package/test/Config/files/empty.json +3 -0
- package/test/Config/files/invalid.json +1 -0
- package/test/Config/files/valid.json +5 -0
- package/test/Objects/Story.test.js +43 -0
- package/test/Objects/StoryFormat.test.js +60 -0
- package/types/Config/parser.d.ts +6 -0
- package/types/Config/reader.d.ts +11 -0
- package/types/Passage.d.ts +2 -2
- package/types/Story.d.ts +5 -5
- package/types/StoryFormat/compile.d.ts +8 -0
- package/types/StoryFormat.d.ts +7 -0
- package/build/extwee +0 -0
- package/build/extwee.exe +0 -0
- package/build/extwee.web.min.js +0 -2
- package/build/extwee.web.min.js.LICENSE.txt +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a JSON file and return its contents.
|
|
3
|
+
* @param {string} path Path to the JSON file.
|
|
4
|
+
* @returns {object} Parsed JSON object.
|
|
5
|
+
* @throws {Error} If the file does not exist.
|
|
6
|
+
* @throws {Error} If the file is not a valid JSON file.
|
|
7
|
+
* @example
|
|
8
|
+
* const contents = reader('test/Config/files/valid.json');
|
|
9
|
+
* console.log(contents); // {"story-format": 'Harlowe', "story-title": "My Story"}
|
|
10
|
+
*/
|
|
11
|
+
export function reader(path: string): object;
|
package/types/Passage.d.ts
CHANGED
|
@@ -68,12 +68,12 @@ export default class Passage {
|
|
|
68
68
|
* @param {object} m - Replacement object
|
|
69
69
|
* @throws {Error} Metadata must be an object literal!
|
|
70
70
|
*/
|
|
71
|
-
set metadata(m:
|
|
71
|
+
set metadata(m: object);
|
|
72
72
|
/**
|
|
73
73
|
* Metadata
|
|
74
74
|
* @returns {object} Metadata
|
|
75
75
|
*/
|
|
76
|
-
get metadata():
|
|
76
|
+
get metadata(): object;
|
|
77
77
|
/**
|
|
78
78
|
* @param {string} t - Replacement text
|
|
79
79
|
* @throws {Error} Text should be a String!
|
package/types/Story.d.ts
CHANGED
|
@@ -50,12 +50,12 @@ export class Story {
|
|
|
50
50
|
/**
|
|
51
51
|
* @param {object} a - Replacement tag colors
|
|
52
52
|
*/
|
|
53
|
-
set tagColors(a:
|
|
53
|
+
set tagColors(a: object);
|
|
54
54
|
/**
|
|
55
55
|
* Tag Colors object (each property is a tag and its color)
|
|
56
56
|
* @returns {object} tag colors array
|
|
57
57
|
*/
|
|
58
|
-
get tagColors():
|
|
58
|
+
get tagColors(): object;
|
|
59
59
|
/**
|
|
60
60
|
* @param {string} i - Replacement IFID.
|
|
61
61
|
*/
|
|
@@ -86,12 +86,12 @@ export class Story {
|
|
|
86
86
|
/**
|
|
87
87
|
* @param {object} o - Replacement metadata
|
|
88
88
|
*/
|
|
89
|
-
set metadata(o:
|
|
89
|
+
set metadata(o: object);
|
|
90
90
|
/**
|
|
91
91
|
* Metadata of Story.
|
|
92
92
|
* @returns {object} metadata of story
|
|
93
93
|
*/
|
|
94
|
-
get metadata():
|
|
94
|
+
get metadata(): object;
|
|
95
95
|
/**
|
|
96
96
|
* @param {string} f - Replacement format
|
|
97
97
|
*/
|
|
@@ -226,5 +226,5 @@ export class Story {
|
|
|
226
226
|
#private;
|
|
227
227
|
}
|
|
228
228
|
export const creatorName: "extwee";
|
|
229
|
-
export const creatorVersion: "2.2.
|
|
229
|
+
export const creatorVersion: "2.2.6";
|
|
230
230
|
import Passage from './Passage.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiles a {@link StoryFormat} object into a JSONP string for writing to a `format.js` file.
|
|
3
|
+
* @see {@link https://github.com/iftechfoundation/twine-specs/blob/master/twine-2-storyformats-spec.md Twine 2 Story Formats Specification}
|
|
4
|
+
* @param {StoryFormat} storyFormat Story format object to compile.
|
|
5
|
+
* @returns {string} JSONP string.
|
|
6
|
+
*/
|
|
7
|
+
export function compile(storyFormat: StoryFormat): string;
|
|
8
|
+
import StoryFormat from '../StoryFormat.js';
|
package/types/StoryFormat.d.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* sf.source = 'New';
|
|
31
31
|
*/
|
|
32
32
|
export default class StoryFormat {
|
|
33
|
+
constructor(name?: string, version?: string, description?: string, author?: string, image?: string, url?: string, license?: string, proofing?: boolean, source?: string);
|
|
33
34
|
/**
|
|
34
35
|
* @param {string} n - Replacement name.
|
|
35
36
|
*/
|
|
@@ -117,5 +118,11 @@ export default class StoryFormat {
|
|
|
117
118
|
* @returns {string} - A string representation of the story format.
|
|
118
119
|
*/
|
|
119
120
|
toString(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Produces a JSON representation of the story format object.
|
|
123
|
+
* @method toJSON
|
|
124
|
+
* @returns {object} - A JSON representation of the story format.
|
|
125
|
+
*/
|
|
126
|
+
toJSON(): object;
|
|
120
127
|
#private;
|
|
121
128
|
}
|
package/build/extwee
DELETED
|
Binary file
|
package/build/extwee.exe
DELETED
|
Binary file
|