markup-creator
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
exports.__RewireAPI__ = exports.__ResetDependency__ = exports.__set__ = exports.__Rewire__ = exports.__GetDependency__ = exports.__get__ = undefined; | ||
@@ -14,2 +15,148 @@ var _rawContentStateToHtml = require('./rawContentStateToHtml'); | ||
exports.default = { rawContentStateToHtml: _rawContentStateToHtml2.default }; | ||
let _DefaultExportValue = { rawContentStateToHtml: _get__('rawContentStateToHtml') }; | ||
exports.default = _DefaultExportValue; | ||
var _RewiredData__ = Object.create(null); | ||
var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__'; | ||
let _RewireAPI__ = {}; | ||
(function () { | ||
function addPropertyToAPIObject(name, value) { | ||
Object.defineProperty(_RewireAPI__, name, { | ||
value: value, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
} | ||
addPropertyToAPIObject('__get__', _get__); | ||
addPropertyToAPIObject('__GetDependency__', _get__); | ||
addPropertyToAPIObject('__Rewire__', _set__); | ||
addPropertyToAPIObject('__set__', _set__); | ||
addPropertyToAPIObject('__reset__', _reset__); | ||
addPropertyToAPIObject('__ResetDependency__', _reset__); | ||
addPropertyToAPIObject('__with__', _with__); | ||
})(); | ||
function _get__(variableName) { | ||
if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||
return _get_original__(variableName); | ||
} else { | ||
var value = _RewiredData__[variableName]; | ||
if (value === INTENTIONAL_UNDEFINED) { | ||
return undefined; | ||
} else { | ||
return value; | ||
} | ||
} | ||
} | ||
function _get_original__(variableName) { | ||
switch (variableName) { | ||
case 'rawContentStateToHtml': | ||
return _rawContentStateToHtml2.default; | ||
} | ||
return undefined; | ||
} | ||
function _assign__(variableName, value) { | ||
if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||
return _set_original__(variableName, value); | ||
} else { | ||
return _RewiredData__[variableName] = value; | ||
} | ||
} | ||
function _set_original__(variableName, _value) { | ||
switch (variableName) {} | ||
return undefined; | ||
} | ||
function _update_operation__(operation, variableName, prefix) { | ||
var oldValue = _get__(variableName); | ||
var newValue = operation === '++' ? oldValue + 1 : oldValue - 1; | ||
_assign__(variableName, newValue); | ||
return prefix ? newValue : oldValue; | ||
} | ||
function _set__(variableName, value) { | ||
if (typeof variableName === 'object') { | ||
Object.keys(variableName).forEach(function (name) { | ||
_RewiredData__[name] = variableName[name]; | ||
}); | ||
} else { | ||
if (value === undefined) { | ||
_RewiredData__[variableName] = INTENTIONAL_UNDEFINED; | ||
} else { | ||
_RewiredData__[variableName] = value; | ||
} | ||
return value; | ||
} | ||
} | ||
function _reset__(variableName) { | ||
delete _RewiredData__[variableName]; | ||
} | ||
function _with__(object) { | ||
var rewiredVariableNames = Object.keys(object); | ||
var previousValues = {}; | ||
function reset() { | ||
rewiredVariableNames.forEach(function (variableName) { | ||
_RewiredData__[variableName] = previousValues[variableName]; | ||
}); | ||
} | ||
return function (callback) { | ||
rewiredVariableNames.forEach(function (variableName) { | ||
previousValues[variableName] = _RewiredData__[variableName]; | ||
_RewiredData__[variableName] = object[variableName]; | ||
}); | ||
let result = callback(); | ||
if (!!result && typeof result.then == 'function') { | ||
result.then(reset).catch(reset); | ||
} else { | ||
reset(); | ||
} | ||
return result; | ||
}; | ||
} | ||
let _typeOfOriginalExport = typeof _DefaultExportValue; | ||
function addNonEnumerableProperty(name, value) { | ||
Object.defineProperty(_DefaultExportValue, name, { | ||
value: value, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
} | ||
if ((_typeOfOriginalExport === 'object' || _typeOfOriginalExport === 'function') && Object.isExtensible(_DefaultExportValue)) { | ||
addNonEnumerableProperty('__get__', _get__); | ||
addNonEnumerableProperty('__GetDependency__', _get__); | ||
addNonEnumerableProperty('__Rewire__', _set__); | ||
addNonEnumerableProperty('__set__', _set__); | ||
addNonEnumerableProperty('__reset__', _reset__); | ||
addNonEnumerableProperty('__ResetDependency__', _reset__); | ||
addNonEnumerableProperty('__with__', _with__); | ||
addNonEnumerableProperty('__RewireAPI__', _RewireAPI__); | ||
} | ||
exports.__get__ = _get__; | ||
exports.__GetDependency__ = _get__; | ||
exports.__Rewire__ = _set__; | ||
exports.__set__ = _set__; | ||
exports.__ResetDependency__ = _reset__; | ||
exports.__RewireAPI__ = _RewireAPI__; |
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
exports.__RewireAPI__ = exports.__ResetDependency__ = exports.__set__ = exports.__Rewire__ = exports.__GetDependency__ = exports.__get__ = undefined; | ||
exports.default = rawContentStateToHtml; | ||
@@ -14,4 +15,152 @@ | ||
function rawContentStateToHtml(contentStateJson, config) { | ||
const contentState = (0, _draftJs.convertFromRaw)(contentStateJson); | ||
return (0, _draftJsExportHtml.stateToHTML)(contentState, config); | ||
} | ||
const contentState = _get__('convertFromRaw')(contentStateJson); | ||
return _get__('stateToHTML')(contentState, config); | ||
} | ||
var _RewiredData__ = Object.create(null); | ||
var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__'; | ||
let _RewireAPI__ = {}; | ||
(function () { | ||
function addPropertyToAPIObject(name, value) { | ||
Object.defineProperty(_RewireAPI__, name, { | ||
value: value, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
} | ||
addPropertyToAPIObject('__get__', _get__); | ||
addPropertyToAPIObject('__GetDependency__', _get__); | ||
addPropertyToAPIObject('__Rewire__', _set__); | ||
addPropertyToAPIObject('__set__', _set__); | ||
addPropertyToAPIObject('__reset__', _reset__); | ||
addPropertyToAPIObject('__ResetDependency__', _reset__); | ||
addPropertyToAPIObject('__with__', _with__); | ||
})(); | ||
function _get__(variableName) { | ||
if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||
return _get_original__(variableName); | ||
} else { | ||
var value = _RewiredData__[variableName]; | ||
if (value === INTENTIONAL_UNDEFINED) { | ||
return undefined; | ||
} else { | ||
return value; | ||
} | ||
} | ||
} | ||
function _get_original__(variableName) { | ||
switch (variableName) { | ||
case 'convertFromRaw': | ||
return _draftJs.convertFromRaw; | ||
case 'stateToHTML': | ||
return _draftJsExportHtml.stateToHTML; | ||
} | ||
return undefined; | ||
} | ||
function _assign__(variableName, value) { | ||
if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||
return _set_original__(variableName, value); | ||
} else { | ||
return _RewiredData__[variableName] = value; | ||
} | ||
} | ||
function _set_original__(variableName, _value) { | ||
switch (variableName) {} | ||
return undefined; | ||
} | ||
function _update_operation__(operation, variableName, prefix) { | ||
var oldValue = _get__(variableName); | ||
var newValue = operation === '++' ? oldValue + 1 : oldValue - 1; | ||
_assign__(variableName, newValue); | ||
return prefix ? newValue : oldValue; | ||
} | ||
function _set__(variableName, value) { | ||
if (typeof variableName === 'object') { | ||
Object.keys(variableName).forEach(function (name) { | ||
_RewiredData__[name] = variableName[name]; | ||
}); | ||
} else { | ||
if (value === undefined) { | ||
_RewiredData__[variableName] = INTENTIONAL_UNDEFINED; | ||
} else { | ||
_RewiredData__[variableName] = value; | ||
} | ||
return value; | ||
} | ||
} | ||
function _reset__(variableName) { | ||
delete _RewiredData__[variableName]; | ||
} | ||
function _with__(object) { | ||
var rewiredVariableNames = Object.keys(object); | ||
var previousValues = {}; | ||
function reset() { | ||
rewiredVariableNames.forEach(function (variableName) { | ||
_RewiredData__[variableName] = previousValues[variableName]; | ||
}); | ||
} | ||
return function (callback) { | ||
rewiredVariableNames.forEach(function (variableName) { | ||
previousValues[variableName] = _RewiredData__[variableName]; | ||
_RewiredData__[variableName] = object[variableName]; | ||
}); | ||
let result = callback(); | ||
if (!!result && typeof result.then == 'function') { | ||
result.then(reset).catch(reset); | ||
} else { | ||
reset(); | ||
} | ||
return result; | ||
}; | ||
} | ||
let _typeOfOriginalExport = typeof rawContentStateToHtml; | ||
function addNonEnumerableProperty(name, value) { | ||
Object.defineProperty(rawContentStateToHtml, name, { | ||
value: value, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
} | ||
if ((_typeOfOriginalExport === 'object' || _typeOfOriginalExport === 'function') && Object.isExtensible(rawContentStateToHtml)) { | ||
addNonEnumerableProperty('__get__', _get__); | ||
addNonEnumerableProperty('__GetDependency__', _get__); | ||
addNonEnumerableProperty('__Rewire__', _set__); | ||
addNonEnumerableProperty('__set__', _set__); | ||
addNonEnumerableProperty('__reset__', _reset__); | ||
addNonEnumerableProperty('__ResetDependency__', _reset__); | ||
addNonEnumerableProperty('__with__', _with__); | ||
addNonEnumerableProperty('__RewireAPI__', _RewireAPI__); | ||
} | ||
exports.__get__ = _get__; | ||
exports.__GetDependency__ = _get__; | ||
exports.__Rewire__ = _set__; | ||
exports.__set__ = _set__; | ||
exports.__ResetDependency__ = _reset__; | ||
exports.__RewireAPI__ = _RewireAPI__; |
{ | ||
"name": "markup-creator", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Get DraftJS ContentState JSON, spew markup", | ||
@@ -22,2 +22,3 @@ "homepage": "http://minutemedia.com", | ||
"babel-eslint": "^6.1.2", | ||
"babel-plugin-rewire": "^1.0.0-rc-5", | ||
"babel-preset-es2015": "6.9.0", | ||
@@ -42,3 +43,6 @@ "babel-preset-es2016-node4": "^6.0.1", | ||
"gulp-plumber": "^1.0.0", | ||
"isparta": "^4.0.0" | ||
"isparta": "^4.0.0", | ||
"rewire": "^2.5.2", | ||
"rewire-webpack": "^1.0.1", | ||
"sinon": "^1.17.5" | ||
}, | ||
@@ -58,5 +62,5 @@ "eslintConfig": { | ||
"draft-js": "^0.7.0", | ||
"draft-js-export-html": "^0.4.0", | ||
"draft-js-export-html": "Vall3y/draft-js-export-html", | ||
"immutable": "^3.8.1" | ||
} | ||
} |
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
11502
258
26
1
2
- Removeddraft-js-export-html@0.4.0(transitive)
- Removeddraft-js-utils@0.1.7(transitive)