textbrowser 0.41.2 → 0.42.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.
package/.eslintignore CHANGED
@@ -1,4 +1,3 @@
1
1
  files-to-incorporate-and-delete
2
2
  node_modules
3
3
  dist
4
- server/main-cjs.js
File without changes
package/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # textbrowser CHANGES
2
2
 
3
+ ## 0.42.0
4
+
5
+ - BREAKING CHANGE: refactor: Native ESM (plugins must be ESM also)
6
+ - chore: removes babel/register, `url-search-params-polyfill` and dialog-polyfill
7
+ - chore: bumps @babel/core (patch) and `simple-get-json` (minor), pins rtl-detect
8
+
3
9
  ## 0.41.2
4
10
 
5
11
  - fix: fix dialog polyfill CSS link
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # TextBrowser
2
2
 
3
3
  *Please note that this project, while now preliminarily functional,
4
- is in its early stages. There are some bugs to iron out such as
5
- with localization.*
4
+ is in its early stages. It is currently unstyled, Chromium-only, and
5
+ potentially intimidating to those unfamiliar with how to work it. There are
6
+ also some bugs to iron out such as with localization.*
7
+
8
+ See the [web app within an app using TextBrowser](https://bahai-browser.org/)
9
+ or see some videos [introducing the app](https://bahai-library.com/zamir_textbrowser_bahaiwritings_browser).
6
10
 
7
11
  *TextBrowser* supports power-user browsing of arbitrary multi-linear
8
12
  texts following the "offline first" motto.
@@ -172,15 +176,15 @@ project.
172
176
 
173
177
  Projects derivative to *TextBrowser* will need to adhere to the following:
174
178
 
175
- 1. Add the *TextBrowser* dependency per the [Installation](#Installation)
179
+ 1. Add the *TextBrowser* dependency per the [Installation](#installation)
176
180
  section.
177
181
 
178
182
  1. Prepare JSON data files, JSON Schema files, and JSON meta-data files
179
183
  to represent your texts. See the section
180
- [JSON Formats](#JSON Formats).
184
+ [JSON Formats](#json-formats).
181
185
  To provide a common naming mechanism across projects and to avoid
182
186
  the need to tweak the default `TextBrowser` JavaScript class set-up, a
183
- [specific directory structure](#Recommended Project Directory Structure)
187
+ [specific directory structure](#recommended-project-directory-structure)
184
188
  is recommended for hosting these files.
185
189
 
186
190
  1. Prepare JSON files to indicate the specific grouping of files you wish
@@ -188,13 +192,13 @@ Projects derivative to *TextBrowser* will need to adhere to the following:
188
192
  make available (and for which you have locales), and after it may be
189
193
  ready, and if you wish, the JSON files to indicate your site hierarchy.
190
194
  See the
191
- [recommended directory structure](#Recommended Project Directory Structure)
195
+ [recommended directory structure](#recommended-project-directory-structure)
192
196
  section for more.
193
197
 
194
198
  1. Create an HTML page (see `index-sample.html` for an example) which includes
195
199
  *TextBrowser*'s own project scripts and your own script to instantiate
196
200
  the `TextBrowser` class (and if you did not follow the
197
- [recommended directory structure](#Recommended Project Directory Structure),
201
+ [recommended directory structure](#recommended-project-directory-structure),
198
202
  you will need to point to the above-mentioned JSON
199
203
  files). Page titles are set dynamically for each page, so there is no
200
204
  need to provide a `<title>`.
@@ -225,9 +229,9 @@ The recommended project directory structure (which are used by default by the
225
229
  service worker
226
230
  - ***plugins/*** - While *not yet in use*, this is the convention we wish
227
231
  to begin enforcing for hosting plugins (e.g., for automated columns).
228
- See [Plugin Format](#Plugin Format).
232
+ See [Plugin Format](#plugin-format).
229
233
  - ***sw.js*** - Although you can change the name of this file via
230
- `serviceWorkerPath` (see [JavaScript API](#JavaScript API)), this
234
+ `serviceWorkerPath` (see [JavaScript API](#javascript-api)), this
231
235
  file should be at or higher than the files you are caching (including
232
236
  *TextBrowser*'s). Copying `sw-sample.js` as `sw.js` at your project
233
237
  root is the recommended approach.
@@ -236,18 +240,18 @@ The recommended project directory structure (which are used by default by the
236
240
  file group, and within each file group, have the JSON data files
237
241
  as well as "schema" and "metadata" subdirectories containing the
238
242
  specific JSON schemas for each data file and the
239
- *TextBrowser*-specific meta-data files. See [JSON Formats](#JSON Formats).
240
- - ***files.json*** - See [JSON Formats](#JSON Formats).
241
- - ***site.json*** - See [JSON Formats](#JSON Formats).
243
+ *TextBrowser*-specific meta-data files. See [JSON Formats](#json-formats).
244
+ - ***files.json*** - See [JSON Formats](#json-formats).
245
+ - ***site.json*** - See [JSON Formats](#json-formats).
242
246
  - ***locales/*** - Only needed if providing an alternate to *TextBrowser*'s
243
247
  own built-in `locales/`. It is recommended to rely on the default
244
248
  files and not add any custom files (contributing back here any
245
249
  localization fixes or additions you may have done!). See
246
- [JSON Formats](#JSON Formats).
250
+ [JSON Formats](#json-formats).
247
251
  - ***languages.json*** - As with `locales/`, only needed if providing an
248
252
  alternate to *TextBrowser*'s own built-in `appdata/languages.json` file.
249
253
  It is recommended to rely on the default and not add any custom file. See
250
- [JSON Formats](#JSON Formats).
254
+ [JSON Formats](#json-formats).
251
255
 
252
256
  ## JSON Formats
253
257
 
@@ -280,9 +284,9 @@ and its simple
280
284
  to which they adhere):
281
285
 
282
286
  1. A `schema` JSON reference pointer to your data's JSON schema.
283
- See [JSON Schema](#JSON Schema).
287
+ See [JSON Schema](#json-schema).
284
288
  2. A `metadata` JSON reference pointer to your data's JSON metadata.
285
- See [JSON Metadata](#JSON Metadata).
289
+ See [JSON Metadata](#json-metadata).
286
290
  3. A `data` property which is an an array of arrays containing your tabular
287
291
  text itself. This property must adhere to the specific JSON schema
288
292
  referenced in the `schema` property above for this file.
@@ -433,7 +437,7 @@ Its keys are plug-in names and whose value objects have the required property
433
437
  code string. There may also be a `meta` key which is used to pass data to the
434
438
  plug-in. This object currently only allows string keys.
435
439
 
436
- See [Plugin Format](#Plugin Format) for the structure of the plug-in pointed
440
+ See [Plugin Format](#plugin-format) for the structure of the plug-in pointed
437
441
  to by the path.
438
442
 
439
443
  The `plugin-field-mapping` object property has keys which act as groups and
@@ -458,7 +462,7 @@ changes you may need of the generic localizations within `locales/` and
458
462
  `appdata/languages.json`, if you need to provide your own interface
459
463
  localization, you may supply a `languages` property when creating the
460
464
  `TextBrowser` object to point to a languages JSON file of your own
461
- choosing (see the [JavaScript API](#JavaScript API)).
465
+ choosing (see the [JavaScript API](#javascript-api)).
462
466
 
463
467
  *TextBrowser* comes with the `languages.json` file at
464
468
  [`appdata/languages.json`](https://github.com/brettz9/textbrowser/blob/master/appdata/languages.json) which, as mentioned, is used by default. It adheres to
@@ -725,7 +729,7 @@ The properties are:
725
729
  - `userStaticFiles` - Array of files additional to those of
726
730
  *TextBrowser* which you will need offline. Defaults to the minimum
727
731
  recommended files:
728
- `['/', 'index.html', 'files.json', 'site.json', 'resources/user.js', 'resources/user.css']`
732
+ `['/', 'index.html', 'files.json', 'site.json', 'resources/user.js']`
729
733
 
730
734
  ## Server API
731
735
 
@@ -4400,14 +4400,6 @@ class PluginsForWork {
4400
4400
  }
4401
4401
  }
4402
4402
 
4403
- let path, babelRegister;
4404
- if (typeof process !== 'undefined') {
4405
- /* eslint-disable node/global-require */
4406
- path = require('path');
4407
- babelRegister = require('@babel/register');
4408
- /* eslint-enable node/global-require */
4409
- }
4410
-
4411
4403
  const getWorkFiles = async function getWorkFiles (files = this.files) {
4412
4404
  const filesObj = await getJSON$1(files);
4413
4405
  const dataFiles = [];
@@ -4532,20 +4524,6 @@ const getWorkData = async function ({
4532
4524
  getPlugins
4533
4525
  ? Promise.all(
4534
4526
  pluginPaths.map((pluginPath) => {
4535
- if (typeof process !== 'undefined') {
4536
- pluginPath = path.resolve(path.join(
4537
- process.cwd(), 'node_modules/textbrowser/server', pluginPath
4538
- ));
4539
- babelRegister({
4540
- presets: ['@babel/env']
4541
- });
4542
- return Promise.resolve().then(() => {
4543
- return require(pluginPath); // eslint-disable-line node/global-require, import/no-dynamic-require
4544
- }).catch((err) => {
4545
- // E.g., with tooltips plugin
4546
- console.log('err', err);
4547
- });
4548
- }
4549
4527
  // eslint-disable-next-line no-unsanitized/method
4550
4528
  return import(pluginPath);
4551
4529
  })