regexp-generator: Use ES modules, update dependencies

This code hasn't been touched in a while, so it's probably good to bring
in the newest versions of the dependencies. We can easily tell if there
was any incompatible effect on the output.

The latest version of filenamify requires using ES modules. We also have
to adapt to a breaking change in regexpu-core (see
https://github.com/mathiasbynens/regexpu-core/pull/49).

Also convert the dependencies to devDependencies, since this tool is not
necessary for executing test262.
This commit is contained in:
Philip Chimento 2024-11-01 16:34:14 -07:00 committed by Philip Chimento
parent 754ecf1ad3
commit 879326855b
3 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
module.exports = description => {
export default description => {
let header = `// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

View File

@ -1,9 +1,10 @@
const fs = require('fs');
const rewritePattern = require('regexpu-core');
const slugify = require('slugify');
const filenamify = require('filenamify');
const jsesc = require('jsesc');
const header = require('./header');
import filenamify from 'filenamify';
import fs from 'node:fs';
import jsesc from 'jsesc';
import rewritePattern from 'regexpu-core';
import slugify from 'slugify';
import header from './header.mjs';
const patterns = {
'whitespace class escape': '\\s',
@ -91,7 +92,7 @@ for (const [desc, escape] of Object.entries(patterns)) {
const pattern = `${escape}${quantifier}`;
const range = rewritePattern(pattern, flags, {
useUnicodeFlag: flags.includes('u')
unicodeFlag: flags.includes('u') ? 'transform' : false,
});
console.log(`${pattern} => ${range}, flags: ${flags}`);

View File

@ -2,23 +2,21 @@
"name": "test262-regexp-class-escapes",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "index.mjs",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"clean": "rimraf ../../test/built-ins/RegExp/CharacterClassEscapes",
"prebuild": "mkdirp ../../test/built-ins/RegExp/CharacterClassEscapes",
"build": "node index.js"
"build": "node index.mjs"
},
"author": "",
"license": "MIT",
"dependencies": {
"filenamify": "^2.1.0",
"jsesc": "^2.5.1",
"regexpu-core": "^4.2.0",
"slugify": "^1.3.0"
},
"devDependencies": {
"filenamify": "^6.0.0",
"jsesc": "^3.0.2",
"mkdirp": "^3.0.1",
"rimraf": "^6.0.1"
"regexpu-core": "^6.1.1",
"rimraf": "^6.0.1",
"slugify": "^1.6.6"
}
}