extwee 2.3.11 → 2.3.13
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/CHANGELOG.md +219 -0
- package/CONTRIBUTING.md +305 -0
- package/README.md +16 -0
- package/build/extwee.core.min.js +1 -1
- package/build/extwee.twine1html.min.js +1 -1
- package/build/extwee.twine2archive.min.js +1 -1
- package/build/extwee.tws.min.js +1 -1
- package/logs/arrays.html +79 -0
- package/logs/arrays.twee +64 -0
- package/logs/example.html +47 -0
- package/logs/fixing.js +23 -0
- package/logs/format-fixed.js +8 -0
- package/logs/format.js +8 -0
- package/logs/test-entities.cjs +40 -0
- package/package.json +19 -16
- package/src/Story.js +2 -2
- package/types/src/Story.d.ts +1 -1
- package/.github/FUNDING.yml +0 -3
- package/.github/codeql-analysis.yml +0 -51
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/dependabot-automerge.yml +0 -23
- package/.github/workflows/nodejs.yml +0 -28
- package/.travis.yml +0 -13
- package/babel.config.json +0 -18
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -224
- package/docs/_sidebar.md +0 -19
- package/docs/build/extwee.core.min.js +0 -1
- package/docs/build/extwee.twine1html.min.js +0 -1
- package/docs/build/extwee.twine2archive.min.js +0 -1
- package/docs/build/extwee.tws.min.js +0 -1
- package/docs/demos/compiler/extwee.core.min.js +0 -1
- package/docs/demos/compiler/index.css +0 -105
- package/docs/demos/compiler/index.html +0 -359
- package/docs/demos/decompile/extwee.core.min.js +0 -1
- package/docs/demos/decompile/index.css +0 -584
- package/docs/demos/decompile/index.html +0 -468
- package/docs/examples/dynamicPassages.md +0 -28
- package/docs/examples/jsonToTwee.md +0 -23
- package/docs/examples/twsToTwee.md +0 -25
- package/docs/formats/json.md +0 -17
- package/docs/formats/twee.md +0 -13
- package/docs/formats/twine1HTML.md +0 -13
- package/docs/formats/twine2ArchiveHTML.md +0 -13
- package/docs/formats/twine2HTML.md +0 -13
- package/docs/formats/tws.md +0 -9
- package/docs/index.html +0 -26
- package/docs/install/npm.md +0 -16
- package/docs/install/npx.md +0 -79
- package/docs/objects/passage.md +0 -47
- package/docs/objects/story.md +0 -69
- package/docs/objects/storyformat.md +0 -27
- package/eslint.config.js +0 -28
- package/extwee.config.json +0 -6
- package/extwee.config.md +0 -67
- package/jest.config.json +0 -5
- package/test/CLI/CLI.test.js +0 -49
- package/test/CLI/files/example.json +0 -1
- package/test/CLI/files/example6.twee +0 -22
- package/test/CLI/files/harlowe.js +0 -3
- package/test/CLI/files/input.html +0 -47
- package/test/CLI/files/output/test.twee +0 -0
- package/test/CLI/files/test.twee +0 -18
- package/test/CLI/files/tweeExample.twee +0 -17
- package/test/CLI/files/twine1/LICENSE.txt +0 -32
- package/test/CLI/files/twine1/code.js +0 -5
- package/test/CLI/files/twine1/engine.js +0 -43
- package/test/CLI/files/twine1/header.html +0 -325
- package/test/CLI/files/twine1Test.html +0 -371
- package/test/CLI/files/twineExample.html +0 -16
- package/test/Config/Config.test.js +0 -76
- package/test/Config/files/empty.json +0 -3
- package/test/Config/files/full.json +0 -8
- package/test/Config/files/invalid.json +0 -1
- package/test/Config/files/valid.json +0 -6
- package/test/Config/isDirectory.test.js +0 -50
- package/test/Config/isFile.test.js +0 -53
- package/test/Config/loadStoryFormat.test.js +0 -117
- package/test/Config/readDirectories.test.js +0 -78
- package/test/IFID/IFID.Generate.test.js +0 -10
- package/test/JSON/JSON.Parse.test.js +0 -316
- package/test/Objects/Passage.test.js +0 -274
- package/test/Objects/SnowmanCompatibility.test.js +0 -111
- package/test/Objects/Story.test.js +0 -1075
- package/test/Objects/StoryFormat.test.js +0 -219
- package/test/Roundtrip/Files/Example1.html +0 -64
- package/test/Roundtrip/Files/LICENSE +0 -19
- package/test/Roundtrip/Files/example1.twee +0 -10
- package/test/Roundtrip/Files/example2.twee +0 -27
- package/test/Roundtrip/Files/example4.twee +0 -27
- package/test/Roundtrip/Files/harlowe.js +0 -3
- package/test/Roundtrip/Files/round.html +0 -49
- package/test/Roundtrip/Roundtrip.test.js +0 -54
- package/test/StoryFormat/StoryFormat.Parse.test.js +0 -479
- package/test/TWS/Parse.test.js +0 -56
- package/test/TWS/TWSParser/Example5.tws +0 -414
- package/test/TWS/TWSParser/noscale.tws +0 -0
- package/test/TWS/TWSParser/nostory.tws +0 -0
- package/test/Twee/Twee.Escaping.test.js +0 -200
- package/test/Twee/Twee.Parse.test.js +0 -108
- package/test/Twee/TweeParser/cursed.twee +0 -16
- package/test/Twee/TweeParser/cycling.twee +0 -75
- package/test/Twee/TweeParser/emptytags.twee +0 -2
- package/test/Twee/TweeParser/example.twee +0 -32
- package/test/Twee/TweeParser/malformed.twee +0 -2
- package/test/Twee/TweeParser/missing.twee +0 -19
- package/test/Twee/TweeParser/multipleScriptPassages.twee +0 -19
- package/test/Twee/TweeParser/multipleStyleTag.twee +0 -19
- package/test/Twee/TweeParser/multipletags.twee +0 -10
- package/test/Twee/TweeParser/noTitle.twee +0 -2
- package/test/Twee/TweeParser/notes.twee +0 -16
- package/test/Twee/TweeParser/pasagemetadataerror.twee +0 -2
- package/test/Twee/TweeParser/scriptPassage.twee +0 -16
- package/test/Twee/TweeParser/singletag.twee +0 -13
- package/test/Twee/TweeParser/start.twee +0 -2
- package/test/Twee/TweeParser/startMetadata.twee +0 -14
- package/test/Twee/TweeParser/storydataerror.twee +0 -25
- package/test/Twee/TweeParser/style.twee +0 -16
- package/test/Twee/TweeParser/stylePassage.twee +0 -16
- package/test/Twee/TweeParser/test.twee +0 -25
- package/test/Twine1HTML/Twine1HTML.Compile.test.js +0 -180
- package/test/Twine1HTML/Twine1HTML.Parse.Web.test.js +0 -484
- package/test/Twine1HTML/Twine1HTML.Parse.test.js +0 -183
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/LICENSE +0 -674
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/engine.js +0 -43
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/jquery.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/Twine1/modernizr.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/engineTest.html +0 -1
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/LICENSE +0 -32
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/code.js +0 -4
- package/test/Twine1HTML/Twine1HTMLCompiler/jonah-1.4.2/header.html +0 -327
- package/test/Twine1HTML/Twine1HTMLCompiler/test.html +0 -0
- package/test/Twine1HTML/Twine1HTMLCompiler/test1.html +0 -6
- package/test/Twine1HTML/Twine1HTMLCompiler/test2.html +0 -6
- package/test/Twine1HTML/Twine1HTMLCompiler/test3.html +0 -43
- package/test/Twine1HTML/Twine1HTMLCompiler/test4.html +0 -372
- package/test/Twine1HTML/Twine1HTMLCompiler/test5.html +0 -372
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Compile.test.js +0 -35
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.Web.test.js +0 -293
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTML.Parse.test.js +0 -42
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLCompiler/test1.html +0 -6
- package/test/Twine2ArchiveHTML/Twine2ArchiveHTMLParser/test1.html +0 -3
- package/test/Twine2HTML/Twine2HTML.Compile.test.js +0 -139
- package/test/Twine2HTML/Twine2HTML.Parse.Web.test.js +0 -329
- package/test/Twine2HTML/Twine2HTML.Parse.test.js +0 -192
- package/test/Twine2HTML/Twine2HTMLCompiler/TestTags.html +0 -42
- package/test/Twine2HTML/Twine2HTMLCompiler/creator.html +0 -50
- package/test/Twine2HTML/Twine2HTMLCompiler/example6.twee +0 -16
- package/test/Twine2HTML/Twine2HTMLCompiler/format.js +0 -9
- package/test/Twine2HTML/Twine2HTMLCompiler/missingStoryTitle.twee +0 -29
- package/test/Twine2HTML/Twine2HTMLCompiler/test11.html +0 -121
- package/test/Twine2HTML/Twine2HTMLCompiler/test2.html +0 -58
- package/test/Twine2HTML/Twine2HTMLCompiler/test3.html +0 -49
- package/test/Twine2HTML/Twine2HTMLCompiler/test4.html +0 -50
- package/test/Twine2HTML/Twine2HTMLCompiler/test6.html +0 -49
- package/test/Twine2HTML/Twine2HTMLParser/Example1.html +0 -53
- package/test/Twine2HTML/Twine2HTMLParser/Tags.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/lyingStartnode.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/lyingTagColors.html +0 -48
- package/test/Twine2HTML/Twine2HTMLParser/missingCreator.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingCreatorVersion.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingFormat.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingFormatVersion.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingIFID.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingPassageTags.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/missingPosition.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/missingScript.html +0 -14
- package/test/Twine2HTML/Twine2HTMLParser/missingSize.html +0 -35
- package/test/Twine2HTML/Twine2HTMLParser/missingStartnode.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/missingStyle.html +0 -14
- package/test/Twine2HTML/Twine2HTMLParser/missingZoom.html +0 -11
- package/test/Twine2HTML/Twine2HTMLParser/tagColors.html +0 -31
- package/test/Twine2HTML/Twine2HTMLParser/twineExample.html +0 -23
- package/test/Twine2HTML/Twine2HTMLParser/twineExample2.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/twineExample3.html +0 -15
- package/test/Twine2HTML/Twine2HTMLParser/unescaping.html +0 -33
- package/test/Web/web-core-coverage.test.js +0 -175
- package/test/Web/web-core-global.test.js +0 -93
- package/test/Web/web-core.test.js +0 -156
- package/test/Web/web-exports.test.js +0 -136
- package/test/Web/web-twine1html.test.js +0 -105
- package/test/Web/web-twine2archive.test.js +0 -96
- package/test/Web/web-tws.test.js +0 -77
- package/test/Web/window.Extwee.test.js +0 -97
- package/tsconfig.json +0 -21
- package/webpack.config.js +0 -47
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment node
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tests for web-twine2archive.js module
|
|
7
|
-
* Tests module exports and functionality
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { describe, expect, it } from '@jest/globals';
|
|
11
|
-
|
|
12
|
-
// Import to test basic functionality
|
|
13
|
-
import { parse, compile } from '../../src/Web/web-twine2archive.js';
|
|
14
|
-
import Extwee from '../../src/Web/web-twine2archive.js';
|
|
15
|
-
|
|
16
|
-
describe('web-twine2archive.js module tests', () => {
|
|
17
|
-
|
|
18
|
-
describe('ES6 module exports', () => {
|
|
19
|
-
it('should export parse and compile functions', () => {
|
|
20
|
-
expect(parse).toBeDefined();
|
|
21
|
-
expect(compile).toBeDefined();
|
|
22
|
-
expect(typeof parse).toBe('function');
|
|
23
|
-
expect(typeof compile).toBe('function');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should export default object with parseTwine2ArchiveHTML and compileTwine2ArchiveHTML', () => {
|
|
27
|
-
expect(Extwee.parseTwine2ArchiveHTML).toBeDefined();
|
|
28
|
-
expect(Extwee.compileTwine2ArchiveHTML).toBeDefined();
|
|
29
|
-
expect(Extwee.parse).toBeDefined();
|
|
30
|
-
expect(Extwee.compile).toBeDefined();
|
|
31
|
-
expect(typeof Extwee.parseTwine2ArchiveHTML).toBe('function');
|
|
32
|
-
expect(typeof Extwee.compileTwine2ArchiveHTML).toBe('function');
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('Global object assignment', () => {
|
|
37
|
-
it('should assign functions to global object when available', () => {
|
|
38
|
-
// In Node.js environment, should assign to globalThis
|
|
39
|
-
expect(globalThis.Extwee).toBeDefined();
|
|
40
|
-
expect(globalThis.Extwee.parseTwine2ArchiveHTML).toBeDefined();
|
|
41
|
-
expect(globalThis.Extwee.compileTwine2ArchiveHTML).toBeDefined();
|
|
42
|
-
expect(typeof globalThis.Extwee.parseTwine2ArchiveHTML).toBe('function');
|
|
43
|
-
expect(typeof globalThis.Extwee.compileTwine2ArchiveHTML).toBe('function');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should preserve existing Extwee properties', () => {
|
|
47
|
-
// Should not overwrite the entire object, just add properties
|
|
48
|
-
if (globalThis.Extwee && globalThis.Extwee.version) {
|
|
49
|
-
expect(globalThis.Extwee.version).toBeDefined();
|
|
50
|
-
}
|
|
51
|
-
expect(globalThis.Extwee.parseTwine2ArchiveHTML).toBeDefined();
|
|
52
|
-
expect(globalThis.Extwee.compileTwine2ArchiveHTML).toBeDefined();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('Functional integration tests', () => {
|
|
57
|
-
it('should have working parseTwine2ArchiveHTML function', () => {
|
|
58
|
-
// Test with valid Twine 2 Archive HTML
|
|
59
|
-
const sampleHtml = `
|
|
60
|
-
<tw-storydata name="Test" startnode="1" creator="Twine" creator-version="2.3.5">
|
|
61
|
-
<tw-passagedata pid="1" name="Start" tags="">Start passage</tw-passagedata>
|
|
62
|
-
</tw-storydata>
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
expect(() => {
|
|
66
|
-
const result = parse(sampleHtml);
|
|
67
|
-
expect(result).toBeDefined();
|
|
68
|
-
expect(Array.isArray(result)).toBe(true);
|
|
69
|
-
}).not.toThrow();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should have working compileTwine2ArchiveHTML function', async () => {
|
|
73
|
-
// Import required classes
|
|
74
|
-
const { Story } = await import('../../src/Story.js');
|
|
75
|
-
const { default: Passage } = await import('../../src/Passage.js');
|
|
76
|
-
|
|
77
|
-
const story = new Story();
|
|
78
|
-
story.name = "Test Story";
|
|
79
|
-
story.IFID = "12345678-1234-5678-9012-123456789012";
|
|
80
|
-
story.addPassage(new Passage("Start", "This is the start", [], {}));
|
|
81
|
-
|
|
82
|
-
expect(() => {
|
|
83
|
-
const result = compile([story]);
|
|
84
|
-
expect(typeof result).toBe('string');
|
|
85
|
-
}).not.toThrow();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should have same functions in exports and global', () => {
|
|
89
|
-
// Test that parse and compile are the same functions
|
|
90
|
-
expect(parse).toBe(Extwee.parse);
|
|
91
|
-
expect(compile).toBe(Extwee.compile);
|
|
92
|
-
expect(parse).toBe(Extwee.parseTwine2ArchiveHTML);
|
|
93
|
-
expect(compile).toBe(Extwee.compileTwine2ArchiveHTML);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
package/test/Web/web-tws.test.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment node
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tests for web-tws.js module
|
|
7
|
-
* Tests module exports and functionality
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { describe, expect, it } from '@jest/globals';
|
|
11
|
-
|
|
12
|
-
// Import to test basic functionality
|
|
13
|
-
import { parse } from '../../src/Web/web-tws.js';
|
|
14
|
-
import Extwee from '../../src/Web/web-tws.js';
|
|
15
|
-
|
|
16
|
-
describe('web-tws.js module tests', () => {
|
|
17
|
-
|
|
18
|
-
describe('ES6 module exports', () => {
|
|
19
|
-
it('should export parse function', () => {
|
|
20
|
-
expect(parse).toBeDefined();
|
|
21
|
-
expect(typeof parse).toBe('function');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should export default object with parseTWS', () => {
|
|
25
|
-
expect(Extwee.parseTWS).toBeDefined();
|
|
26
|
-
expect(Extwee.parse).toBeDefined();
|
|
27
|
-
expect(typeof Extwee.parseTWS).toBe('function');
|
|
28
|
-
expect(typeof Extwee.parse).toBe('function');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('Global object assignment', () => {
|
|
33
|
-
it('should assign functions to global object when available', () => {
|
|
34
|
-
// In Node.js environment, should assign to globalThis
|
|
35
|
-
expect(globalThis.Extwee).toBeDefined();
|
|
36
|
-
expect(globalThis.Extwee.parseTWS).toBeDefined();
|
|
37
|
-
expect(typeof globalThis.Extwee.parseTWS).toBe('function');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should preserve existing Extwee properties', () => {
|
|
41
|
-
// Should not overwrite the entire object, just add properties
|
|
42
|
-
if (globalThis.Extwee && globalThis.Extwee.version) {
|
|
43
|
-
expect(globalThis.Extwee.version).toBeDefined();
|
|
44
|
-
}
|
|
45
|
-
expect(globalThis.Extwee.parseTWS).toBeDefined();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('Functional integration tests', () => {
|
|
50
|
-
it('should have working parseTWS function', () => {
|
|
51
|
-
// Create a minimal valid TWS buffer (pickled data)
|
|
52
|
-
// This is a very basic test - TWS parsing is complex
|
|
53
|
-
const validBuffer = Buffer.from([
|
|
54
|
-
0x80, 0x02, // Python pickle protocol version 2
|
|
55
|
-
0x7d, 0x71, 0x00, // Empty dict
|
|
56
|
-
0x2e // STOP
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
expect(() => {
|
|
60
|
-
const result = parse(validBuffer);
|
|
61
|
-
expect(result).toBeDefined();
|
|
62
|
-
}).not.toThrow();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should throw error for invalid input', () => {
|
|
66
|
-
expect(() => {
|
|
67
|
-
parse("not a buffer");
|
|
68
|
-
}).toThrow();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should have same functions in exports and global', () => {
|
|
72
|
-
// Test that parse is the same function
|
|
73
|
-
expect(parse).toBe(Extwee.parse);
|
|
74
|
-
expect(parse).toBe(Extwee.parseTWS);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Load the core web module to set up window.Extwee
|
|
6
|
-
import '../../src/Web/web-core.js';
|
|
7
|
-
|
|
8
|
-
// Load additional modular parsers
|
|
9
|
-
import '../../src/Web/web-twine1html.js';
|
|
10
|
-
import '../../src/Web/web-twine2archive.js';
|
|
11
|
-
import '../../src/Web/web-tws.js';
|
|
12
|
-
|
|
13
|
-
describe('Extwee', () => {
|
|
14
|
-
it('should have all the expected immediate properties', () => {
|
|
15
|
-
// Core functionality that's immediately available
|
|
16
|
-
expect(window.Extwee).toHaveProperty('parseTwee');
|
|
17
|
-
expect(window.Extwee).toHaveProperty('parseJSON');
|
|
18
|
-
expect(window.Extwee).toHaveProperty('parseStoryFormat');
|
|
19
|
-
expect(window.Extwee).toHaveProperty('parseTwine2HTML');
|
|
20
|
-
expect(window.Extwee).toHaveProperty('compileTwine2HTML');
|
|
21
|
-
expect(window.Extwee).toHaveProperty('generateIFID');
|
|
22
|
-
expect(window.Extwee).toHaveProperty('Story');
|
|
23
|
-
expect(window.Extwee).toHaveProperty('Passage');
|
|
24
|
-
expect(window.Extwee).toHaveProperty('StoryFormat');
|
|
25
|
-
|
|
26
|
-
// Additional parsers loaded via modular imports
|
|
27
|
-
expect(window.Extwee).toHaveProperty('parseTwine1HTML');
|
|
28
|
-
expect(window.Extwee).toHaveProperty('parseTwine2ArchiveHTML');
|
|
29
|
-
expect(window.Extwee).toHaveProperty('parseTWS');
|
|
30
|
-
expect(window.Extwee).toHaveProperty('compileTwine1HTML');
|
|
31
|
-
expect(window.Extwee).toHaveProperty('compileTwine2ArchiveHTML');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should have the expected types for immediate functions', () => {
|
|
35
|
-
// Core functionality
|
|
36
|
-
expect(typeof window.Extwee.parseTwee).toBe('function');
|
|
37
|
-
expect(typeof window.Extwee.parseJSON).toBe('function');
|
|
38
|
-
expect(typeof window.Extwee.parseStoryFormat).toBe('function');
|
|
39
|
-
expect(typeof window.Extwee.parseTwine2HTML).toBe('function');
|
|
40
|
-
expect(typeof window.Extwee.compileTwine2HTML).toBe('function');
|
|
41
|
-
expect(typeof window.Extwee.generateIFID).toBe('function');
|
|
42
|
-
expect(typeof window.Extwee.Story).toBe('function');
|
|
43
|
-
expect(typeof window.Extwee.Passage).toBe('function');
|
|
44
|
-
expect(typeof window.Extwee.StoryFormat).toBe('function');
|
|
45
|
-
|
|
46
|
-
// Additional parsers
|
|
47
|
-
expect(typeof window.Extwee.parseTwine1HTML).toBe('function');
|
|
48
|
-
expect(typeof window.Extwee.parseTwine2ArchiveHTML).toBe('function');
|
|
49
|
-
expect(typeof window.Extwee.parseTWS).toBe('function');
|
|
50
|
-
expect(typeof window.Extwee.compileTwine1HTML).toBe('function');
|
|
51
|
-
expect(typeof window.Extwee.compileTwine2ArchiveHTML).toBe('function');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should have the expected properties in StoryFormat', () => {
|
|
55
|
-
const storyFormat = new window.Extwee.StoryFormat();
|
|
56
|
-
expect(storyFormat).toHaveProperty('name');
|
|
57
|
-
expect(storyFormat).toHaveProperty('version');
|
|
58
|
-
expect(storyFormat).toHaveProperty('description');
|
|
59
|
-
expect(storyFormat).toHaveProperty('author');
|
|
60
|
-
expect(storyFormat).toHaveProperty('image');
|
|
61
|
-
expect(storyFormat).toHaveProperty('url');
|
|
62
|
-
expect(storyFormat).toHaveProperty('license');
|
|
63
|
-
expect(storyFormat).toHaveProperty('proofing');
|
|
64
|
-
expect(storyFormat).toHaveProperty('source');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should have the expected properties in Story', () => {
|
|
68
|
-
const story = new window.Extwee.Story();
|
|
69
|
-
expect(story).toHaveProperty('name');
|
|
70
|
-
expect(story).toHaveProperty('IFID');
|
|
71
|
-
expect(story).toHaveProperty('start');
|
|
72
|
-
expect(story).toHaveProperty('format');
|
|
73
|
-
expect(story).toHaveProperty('formatVersion');
|
|
74
|
-
expect(story).toHaveProperty('zoom');
|
|
75
|
-
expect(story).toHaveProperty('passages');
|
|
76
|
-
expect(story).toHaveProperty('creator');
|
|
77
|
-
expect(story).toHaveProperty('creatorVersion');
|
|
78
|
-
expect(story).toHaveProperty('metadata');
|
|
79
|
-
expect(story).toHaveProperty('tagColors');
|
|
80
|
-
expect(story).toHaveProperty('storyJavaScript');
|
|
81
|
-
expect(story).toHaveProperty('storyStylesheet');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should have the expected types in Passage', () => {
|
|
85
|
-
const passage = new window.Extwee.Passage();
|
|
86
|
-
expect(passage).toHaveProperty('name');
|
|
87
|
-
expect(passage).toHaveProperty('text');
|
|
88
|
-
expect(passage).toHaveProperty('tags');
|
|
89
|
-
expect(passage).toHaveProperty('metadata');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should generate a valid IFID', () => {
|
|
93
|
-
const ifid = window.Extwee.generateIFID();
|
|
94
|
-
expect(ifid).toMatch(/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Change this to match your project
|
|
3
|
-
"include": ["src/**/*"],
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
// Tells TypeScript to read JS files, as
|
|
6
|
-
// normally they are ignored as source files
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
// Generate d.ts files
|
|
9
|
-
"declaration": true,
|
|
10
|
-
// This compiler run should
|
|
11
|
-
// only output d.ts files
|
|
12
|
-
"emitDeclarationOnly": true,
|
|
13
|
-
// Types should go into this directory.
|
|
14
|
-
// Removing this would place the .d.ts files
|
|
15
|
-
// next to the .js files
|
|
16
|
-
"outDir": "types",
|
|
17
|
-
// go to js file when using IDE functions like
|
|
18
|
-
// "Go to Definition" in VSCode
|
|
19
|
-
"declarationMap": true
|
|
20
|
-
}
|
|
21
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import webpack from 'webpack';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
mode: 'production',
|
|
6
|
-
entry: {
|
|
7
|
-
// Core bundle with most common functionality
|
|
8
|
-
'extwee.core': './src/Web/web-core.js',
|
|
9
|
-
// Individual parser modules
|
|
10
|
-
'extwee.twine1html': './src/Web/web-twine1html.js',
|
|
11
|
-
'extwee.twine2archive': './src/Web/web-twine2archive.js',
|
|
12
|
-
'extwee.tws': './src/Web/web-tws.js'
|
|
13
|
-
},
|
|
14
|
-
output: {
|
|
15
|
-
path: path.resolve('./', 'build'),
|
|
16
|
-
filename: '[name].min.js',
|
|
17
|
-
library: {
|
|
18
|
-
type: 'umd',
|
|
19
|
-
name: 'Extwee', // Use a single library name for all modules
|
|
20
|
-
export: 'default' // Export the default export directly
|
|
21
|
-
},
|
|
22
|
-
globalObject: 'this'
|
|
23
|
-
},
|
|
24
|
-
plugins: [
|
|
25
|
-
// Replace Node.js IFID generator with browser version for web builds
|
|
26
|
-
new webpack.NormalModuleReplacementPlugin(
|
|
27
|
-
/src[\\/]IFID[\\/]generate\.js$/,
|
|
28
|
-
'./generate-web.js'
|
|
29
|
-
)
|
|
30
|
-
],
|
|
31
|
-
resolve: {
|
|
32
|
-
fallback: {
|
|
33
|
-
// Exclude Node.js core modules from browser builds
|
|
34
|
-
'crypto': false
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
optimization: {
|
|
38
|
-
usedExports: true,
|
|
39
|
-
sideEffects: false,
|
|
40
|
-
splitChunks: false // Don't split chunks for individual modules
|
|
41
|
-
},
|
|
42
|
-
performance: {
|
|
43
|
-
maxAssetSize: 250000, // 244 KiB
|
|
44
|
-
maxEntrypointSize: 250000,
|
|
45
|
-
hints: 'warning'
|
|
46
|
-
}
|
|
47
|
-
};
|