Skip to content
Permalink
Browse files

Set minimum Node.js version to 6.0.0

Node.js v6 supports ES5 features, which removes the need for Babel. The
following changes and improvements have been made.

- Development has been moved from the src folder to the lib folder. The
  src folder has been removed.
- ES Module imports/exports have been replaced with CommonJS equivalents.
- ESLint now checks for unsupported Node.js features.
- All Babel dependencies have been removed.
- Generating lib/unicode.js is no longer done on every build. It is now
  done using `npm run build-unicode`. It is only necessary when the
  version of Unicode has changed.
- NPM scripts have been simplified.
  • Loading branch information...
jordanbtucker committed Mar 19, 2018
1 parent 7628711 commit 36c79eb832db1c5dcf75aab6ec9b85aabb8dc15c

This file was deleted.

@@ -1,3 +1,2 @@
coverage/
dist/
lib/
@@ -10,8 +10,7 @@
],
"extends": [
"standard",
"plugin:node/recommended",
"plugin:import/recommended"
"plugin:node/recommended"
],
"rules": {
"array-bracket-spacing": [
@@ -34,8 +33,6 @@
"object-curly-spacing": [
"error",
"never"
],
"node/no-unsupported-features": "off",
"node/shebang": "off"
]
}
}
@@ -37,7 +37,6 @@ jspm_packages
.node_repl_history

.vscode/
lib/
dist/

test/output.json
10 .nycrc

This file was deleted.

@@ -3,6 +3,5 @@ node_js:
- "9"
- "8"
- "6"
- "4"

after_success: npm run coverage

This file was deleted.

@@ -1,9 +1,9 @@
import fs from 'fs'
import path from 'path'
const fs = require('fs')
const path = require('path')

import JSON5 from '../lib'
const JSON5 = require('../lib')

import pkg from '../package.json'
const pkg = require('../package.json')

let pkg5 = '// This is a generated file. Do not edit.\n'
pkg5 += pkg5 = JSON5.stringify(pkg, null, 2)
@@ -0,0 +1,51 @@
/* eslint-disable camelcase */

const fs = require('fs')
const path = require('path')
const regenerate = require('regenerate')

const libDir = 'lib'

const Space_Separator = regenerate()
.add(require('unicode-9.0.0/General_Category/Space_Separator/code-points'))
.remove('\t', '\v', '\f', ' ', '\u00A0', '\uFEFF')

const ID_Start = regenerate()
.add(require('unicode-9.0.0/General_Category/Uppercase_Letter/code-points'))
.add(require('unicode-9.0.0/General_Category/Lowercase_Letter/code-points'))
.add(require('unicode-9.0.0/General_Category/Titlecase_Letter/code-points'))
.add(require('unicode-9.0.0/General_Category/Modifier_Letter/code-points'))
.add(require('unicode-9.0.0/General_Category/Other_Letter/code-points'))
.add(require('unicode-9.0.0/General_Category/Letter_Number/code-points'))
.remove('$', '_')
.removeRange('A', 'Z')
.removeRange('a', 'z')

const ID_Continue = regenerate()
.add(ID_Start)
.add(require('unicode-9.0.0/General_Category/Nonspacing_Mark/code-points'))
.add(require('unicode-9.0.0/General_Category/Spacing_Mark/code-points'))
.add(require('unicode-9.0.0/General_Category/Decimal_Number/code-points'))
.add(require('unicode-9.0.0/General_Category/Connector_Punctuation/code-points'))
.remove('$', '_')
.removeRange('0', '9')
.removeRange('A', 'Z')
.removeRange('a', 'z')

const outDir = libDir
const outPath = path.join(outDir, 'unicode.js')

if (!fs.existsSync(outDir)) {
fs.mkdirSync(outDir)
}

const data = {
Space_Separator,
ID_Start,
ID_Continue,
}

let es6 = '// This is a generated file. Do not edit.\n'
es6 += Object.keys(data).map(key => `module.exports.${key} = /${data[key]}/\n`).join('')

fs.writeFileSync(outPath, es6)
@@ -1,11 +1,10 @@
#!/usr/bin/env node

import fs from 'fs'
import path from 'path'
import minimist from 'minimist'

import pkg from '../package.json'
import JSON5 from './'
const fs = require('fs')
const path = require('path')
const minimist = require('minimist')
const pkg = require('../package.json')
const JSON5 = require('./')

const argv = minimist(process.argv.slice(2), {
alias: {
@@ -0,0 +1,9 @@
const parse = require('./parse')
const stringify = require('./stringify')

const JSON5 = {
parse,
stringify,
}

module.exports = JSON5
@@ -1,4 +1,4 @@
import * as util from './util'
const util = require('./util')

let source
let parseState
@@ -10,7 +10,7 @@ let token
let key
let root

export default function parse (text, reviver) {
module.exports = function parse (text, reviver) {
source = String(text)
parseState = 'start'
stack = []
@@ -1,5 +1,5 @@
import fs from 'fs'
import JSON5 from './'
const fs = require('fs')
const JSON5 = require('./')

// eslint-disable-next-line node/no-deprecated-api
require.extensions['.json5'] = function (module, filename) {
@@ -1,4 +1,4 @@
// This file is for backward compatibility with v0.5.1.
import './register'
require('./register')

console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.")
@@ -1,6 +1,6 @@
import * as util from './util'
const util = require('./util')

export default function stringify (value, replacer, space) {
module.exports = function stringify (value, replacer, space) {
const stack = []
let indent = ''
let propertyList

0 comments on commit 36c79eb

Please sign in to comment.
You can’t perform that action at this time.