@rohal12/twee-ts 1.18.1 → 2.0.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 (42) hide show
  1. package/README.md +23 -3
  2. package/THIRD_PARTY_NOTICES +111 -0
  3. package/UNLICENSE +24 -0
  4. package/dist/bin/twee-ts.js +689 -9335
  5. package/dist/bin/twee-ts.js.map +1 -1
  6. package/dist/diagnostic-text-BRddVulf.cjs +26463 -0
  7. package/dist/diagnostic-text-BRddVulf.cjs.map +1 -0
  8. package/dist/diagnostic-text-CebYCTPQ.js +26040 -0
  9. package/dist/diagnostic-text-CebYCTPQ.js.map +1 -0
  10. package/dist/index.cjs +86 -9026
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +192 -415
  13. package/dist/index.d.ts +192 -415
  14. package/dist/index.js +4 -9206
  15. package/dist/lint-VayZI_jp.js +288 -0
  16. package/dist/lint-VayZI_jp.js.map +1 -0
  17. package/dist/options-DuBkFyqi.d.cts +28 -0
  18. package/dist/options-nc5NpnSc.d.ts +28 -0
  19. package/dist/plugins/rollup.cjs +172 -0
  20. package/dist/plugins/rollup.cjs.map +1 -0
  21. package/dist/plugins/rollup.d.cts +46 -0
  22. package/dist/plugins/rollup.d.ts +7 -12
  23. package/dist/plugins/rollup.js +130 -65
  24. package/dist/plugins/rollup.js.map +1 -1
  25. package/dist/plugins/vite.cjs +1926 -0
  26. package/dist/plugins/vite.cjs.map +1 -0
  27. package/dist/plugins/vite.d.cts +15 -0
  28. package/dist/plugins/vite.d.ts +5 -12
  29. package/dist/plugins/vite.js +1771 -448
  30. package/dist/plugins/vite.js.map +1 -1
  31. package/dist/types-BvI6pg2y.d.cts +389 -0
  32. package/dist/types-BvI6pg2y.d.ts +389 -0
  33. package/dist/watch-targets-BI7jYrwa.js +486 -0
  34. package/dist/watch-targets-BI7jYrwa.js.map +1 -0
  35. package/dist/watch-targets-C0Anuw17.cjs +575 -0
  36. package/dist/watch-targets-C0Anuw17.cjs.map +1 -0
  37. package/package.json +80 -27
  38. package/schemas/twee-ts.config.schema.json +55 -17
  39. package/dist/index.js.map +0 -1
  40. package/dist/paths-CUv1qfz-.js +0 -6926
  41. package/dist/paths-CUv1qfz-.js.map +0 -1
  42. package/dist/types-D8Xfe0l8.d.ts +0 -71
package/README.md CHANGED
@@ -11,7 +11,9 @@
11
11
 
12
12
  TypeScript reimplementation of [Tweego](https://www.motoslave.net/tweego/) — a command-line compiler for Twine/Twee interactive fiction projects.
13
13
 
14
- Zero runtime dependencies. Node.js 22+.
14
+ Zero runtime dependencies (the parsers it uses, parse5 and acorn, are bundled). Node.js 24+.
15
+
16
+ Upgrading from 1.x? Read **[Migrating to 2.0](https://rohal12.github.io/twee-ts/migrating-to-2)**.
15
17
 
16
18
  **[Documentation](https://rohal12.github.io/twee-ts/)**
17
19
 
@@ -51,6 +53,7 @@ const result = await compile({
51
53
  sources: ['src/'],
52
54
  tagAliases: { library: 'script' },
53
55
  });
56
+ console.log(result.diagnostics);
54
57
  ```
55
58
 
56
59
  ## Build Plugins
@@ -71,9 +74,12 @@ Also available: `@rohal12/twee-ts/rollup`. In both plugins, compile errors fail
71
74
  Full docs at **[rohal12.github.io/twee-ts](https://rohal12.github.io/twee-ts/)**:
72
75
 
73
76
  - [Getting Started](https://rohal12.github.io/twee-ts/getting-started)
77
+ - [Differences from Tweego](https://rohal12.github.io/twee-ts/tweego-differences)
78
+ - [Migrating to 2.0](https://rohal12.github.io/twee-ts/migrating-to-2)
74
79
  - [CLI Reference](https://rohal12.github.io/twee-ts/cli)
75
80
  - [Configuration](https://rohal12.github.io/twee-ts/configuration)
76
81
  - [Tag Aliases](https://rohal12.github.io/twee-ts/tag-aliases)
82
+ - [Output Modes](https://rohal12.github.io/twee-ts/output-modes)
77
83
  - [Programmatic API](https://rohal12.github.io/twee-ts/api)
78
84
  - [Vite & Rollup Plugins](https://rohal12.github.io/twee-ts/plugins)
79
85
  - [Story Formats](https://rohal12.github.io/twee-ts/story-formats)
@@ -81,15 +87,29 @@ Full docs at **[rohal12.github.io/twee-ts](https://rohal12.github.io/twee-ts/)**
81
87
 
82
88
  ## Development
83
89
 
90
+ You need Node.js 24 or later and pnpm 12, the version `packageManager` in `package.json` pins; `devEngines` makes the install fail on an older Node.js. Get pnpm 12 with `npm install -g pnpm@12`, or run `corepack enable` and let Corepack read the pinned version. A standalone pnpm 10 or 11 cannot install the project: it tries to switch to the pinned pnpm 12 and fails with `ERR_PNPM_NO_MATCHING_VERSION` for `@pnpm/linux-x64@12.10.1` (pnpm 12 renamed its platform packages), so update pnpm first. [CONTRIBUTING.md](CONTRIBUTING.md) lists the checks a change has to pass.
91
+
84
92
  ```sh
85
93
  pnpm install
86
- pnpm test # run tests
94
+ pnpm test # run tests (including every example in these docs)
87
95
  pnpm run typecheck # type-check
96
+ pnpm run lint # ESLint
88
97
  pnpm run build # bundle
89
98
  pnpm run docs:dev # local docs dev server
90
99
  pnpm run docs:build # build docs for deployment
100
+ pnpm run test:contracts # build, then run the compiler contract matrix against it
91
101
  ```
92
102
 
103
+ Releases need recorded validation evidence: see
104
+ [Compiler Validation and Releases](https://rohal12.github.io/twee-ts/compiler-validation).
105
+
93
106
  ## License
94
107
 
95
- This is free and unencumbered software released into the public domain. See [UNLICENSE](UNLICENSE).
108
+ The twee-ts source code is free and unencumbered software released into the public domain. See [UNLICENSE](UNLICENSE).
109
+
110
+ The published package is not entirely public domain:
111
+
112
+ - twee-ts reimplements [Tweego](https://www.motoslave.net/tweego/) and ports parts of its Go source. Tweego is © Thomas Michael Edwards under the BSD 2-Clause licence.
113
+ - The JavaScript in `dist/` bundles third-party packages (such as parse5 and acorn), which keep their own licences (MIT and BSD 2-Clause).
114
+
115
+ [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) lists every bundled package with its licence text, reproduces Tweego's notice, and ships in the npm package. The build regenerates it from what it actually bundled. If you redistribute twee-ts, or bundle it into your own build, keep that file with it.
@@ -0,0 +1,111 @@
1
+ THIRD-PARTY NOTICES for @rohal12/twee-ts
2
+
3
+ The twee-ts source code is released into the public domain under the Unlicense
4
+ (see UNLICENSE). twee-ts is a reimplementation of Tweego and ports parts of
5
+ Tweego's Go source, so Tweego's licence is reproduced below. The JavaScript
6
+ files in dist/ also bundle the third-party packages listed after it; that code
7
+ stays under its own licence.
8
+
9
+ This file is generated by scripts/third-party-notices.mjs during the build.
10
+ Do not edit it by hand.
11
+
12
+ ================================================================================
13
+ Tweego
14
+ https://www.motoslave.net/tweego/
15
+ License: BSD-2-Clause
16
+ --------------------------------------------------------------------------------
17
+
18
+ Copyright (c) 2014-2020, Thomas Michael Edwards <thomasmedwards@gmail.com>.
19
+ All rights reserved.
20
+
21
+ Redistribution and use in source and binary forms, with or without
22
+ modification, are permitted provided that the following conditions are met:
23
+
24
+ 1. Redistributions of source code must retain the above copyright notice, this
25
+ list of conditions and the following disclaimer.
26
+ 2. Redistributions in binary form must reproduce the above copyright notice,
27
+ this list of conditions and the following disclaimer in the documentation
28
+ and/or other materials provided with the distribution.
29
+
30
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
34
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
+
41
+ ================================================================================
42
+ acorn
43
+ https://github.com/acornjs/acorn
44
+ License: MIT
45
+ --------------------------------------------------------------------------------
46
+
47
+ MIT License
48
+
49
+ Copyright (C) 2012-2022 by various contributors (see AUTHORS)
50
+
51
+ Permission is hereby granted, free of charge, to any person obtaining a copy
52
+ of this software and associated documentation files (the "Software"), to deal
53
+ in the Software without restriction, including without limitation the rights
54
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
+ copies of the Software, and to permit persons to whom the Software is
56
+ furnished to do so, subject to the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be included in
59
+ all copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
67
+ THE SOFTWARE.
68
+
69
+ ================================================================================
70
+ entities
71
+ https://github.com/fb55/entities
72
+ License: BSD-2-Clause
73
+ --------------------------------------------------------------------------------
74
+
75
+ Copyright (c) Felix Böhm
76
+ All rights reserved.
77
+
78
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
79
+
80
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
81
+
82
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
83
+
84
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
85
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86
+
87
+ ================================================================================
88
+ parse5
89
+ https://github.com/inikulin/parse5
90
+ License: MIT
91
+ --------------------------------------------------------------------------------
92
+
93
+ Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
94
+
95
+ Permission is hereby granted, free of charge, to any person obtaining a copy
96
+ of this software and associated documentation files (the "Software"), to deal
97
+ in the Software without restriction, including without limitation the rights
98
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
+ copies of the Software, and to permit persons to whom the Software is
100
+ furnished to do so, subject to the following conditions:
101
+
102
+ The above copyright notice and this permission notice shall be included in
103
+ all copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
106
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
107
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
108
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
109
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
110
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
111
+ THE SOFTWARE.
package/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org/>