@a-la/export
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -1,2 +0,2 @@ | ||
const { debuglog } = require('util') | ||
const { debuglog } = require('util'); | ||
let detect = require('./lib/detect'); if (detect && detect.__esModule) detect = detect.default; | ||
@@ -3,0 +3,0 @@ let detectCurly = require('./lib/detect-curly'); if (detectCurly && detectCurly.__esModule) detectCurly = detectCurly.default; |
// import id, { aliasRegex } from './id' | ||
const { getNamesMap, splitNames, getWs } = require('.') | ||
const { getNamesMap, splitNames, getWs } = require('.'); | ||
@@ -4,0 +4,0 @@ // \\s*((?:${id.source}(?:\\s+as\\s+${aliasRegex.source})?,?\\s*)*)\\s* |
let idRe = require('./id'); if (idRe && idRe.__esModule) idRe = idRe.default; | ||
const { checkReserved, getWs } = require('.') | ||
const { checkReserved, getWs } = require('.'); | ||
@@ -4,0 +4,0 @@ const typeRe = /(?:class|function\s*\*?|async +function)/ |
let idRe = require('./id'); if (idRe && idRe.__esModule) idRe = idRe.default; | ||
const { checkReserved, getWs } = require('.') | ||
const { checkReserved, getWs } = require('.'); | ||
@@ -4,0 +4,0 @@ const typeRe = /(?:let|const|var|class|function\s*\*?|async +function)/ |
@@ -1,2 +0,2 @@ | ||
const { splitNames, getWs } = require('.') | ||
const { splitNames, getWs, fromRe } = require('.'); | ||
@@ -23,9 +23,17 @@ const getPrivateName = (name) => { | ||
const exportRe = /( *export\s+{([^}]+?)})/ | ||
const re = new RegExp(`${exportRe.source}${fromRe.source}`, 'gm') | ||
const defaultRule = { | ||
re: /( *export\s+{([^}]+?)})(\s+from\s+(["'])(.+?)\4)/gm, | ||
replacement(match, exportSeg, names, fromSeg, quotes, from) { | ||
re, | ||
replacement(match, exportSeg, names, fromSeg, sd, ld) { | ||
const realSrc = ld | ||
? this.markers.literals.map[ld] | ||
: this.markers.strings.map[sd] | ||
const [, quotes, src] = /(["'`])(.+?)\1/.exec(realSrc) | ||
const ws = getWs(exportSeg) | ||
const varName = getVarName(from) | ||
const varName = getVarName(src) | ||
const privateName = getPrivateName(varName) | ||
const req = replaceRequire(fromSeg, quotes, from) | ||
const req = replaceRequire(fromSeg, quotes, src) | ||
const s = `${ws}const ${privateName}${req}` | ||
@@ -32,0 +40,0 @@ const n = splitNames(names) |
@@ -1,2 +0,2 @@ | ||
const { reserved } = require('./id') | ||
const { reserved } = require('./id'); | ||
@@ -52,2 +52,5 @@ const splitNames = (name) => { | ||
// temp solution, until restream markers can store only part of regex, e.g. '%RESTREAM_MARKER%' instead of %RESTREAM_MARKER% for a string. | ||
const fromRe = /(\s+from\s+)(?:%%_RESTREAM_STRINGS_REPLACEMENT_(\d+)_%%|%%_RESTREAM_LITERALS_REPLACEMENT_(\d+)_%%)/ | ||
module.exports.splitNames = splitNames | ||
@@ -57,2 +60,3 @@ module.exports.getNamesMap = getNamesMap | ||
module.exports.getWs = getWs | ||
module.exports.fromRe = fromRe | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,7 @@ | ||
## 1 September 2018 | ||
### 1.3.0 | ||
- [feature] Access string and literal markers from `alamode`. | ||
## 27 August 2018 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@a-la/export", | ||
"version": "1.2.2", | ||
"description": "A set of rules for alamode to transpile module.exports into ES6 export statement.", | ||
"version": "1.3.0", | ||
"description": "A set of rules for alamode to transpile ES6 export statement into module.exports assignments.", | ||
"main": "build", | ||
@@ -38,9 +38,9 @@ "scripts": { | ||
"devDependencies": { | ||
"@a-la/context": "1.1.1", | ||
"alamode": "1.2.1", | ||
"catchment": "3.0.0", | ||
"@a-la/context": "1.2.0", | ||
"alamode": "1.3.0", | ||
"catchment": "3.0.1", | ||
"documentary": "1.10.0", | ||
"erte": "1.1.4", | ||
"eslint-config-artdeco": "1.0.1", | ||
"restream": "3.1.0", | ||
"restream": "3.1.1", | ||
"yarn-s": "1.1.0", | ||
@@ -47,0 +47,0 @@ "zoroaster": "2.4.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158188
337