Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit b669268

Browse files
guybedfordlukastaegert
authored andcommitted
dataToNamedExports -> dataToEsm
1 parent 8984870 commit b669268

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ makeLegalIdentifier( 'foo-bar' ); // 'foo_bar'
103103
makeLegalIdentifier( 'typeof' ); // '_typeof'
104104
```
105105

106-
### dataToNamedExports
106+
### dataToEsm
107107

108108
Helper for treeshakable data imports
109109

110110
```js
111-
import { dataToNamedExports } from 'rollup-pluginutils';
111+
import { dataToEsm } from 'rollup-pluginutils';
112112

113-
const esModuleSource = dataToNamedExports({
113+
const esModuleSource = dataToEsm({
114114
custom: 'data',
115115
to: ['treeshake']
116116
});
File renamed without changes.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export { default as addExtension } from './addExtension';
22
export { default as attachScopes } from './attachScopes';
33
export { default as createFilter } from './createFilter';
44
export { default as makeLegalIdentifier } from './makeLegalIdentifier';
5-
export { default as dataToNamedExports } from './dataToNamedExports';
5+
export { default as dataToEsm } from './dataToEsm';

test/test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,20 +443,20 @@ describe( 'rollup-pluginutils', function () {
443443
});
444444
});
445445

446-
describe( 'dataToNamedExports', function () {
447-
var dataToNamedExports = utils.dataToNamedExports;
446+
describe( 'dataToEsm', function () {
447+
var dataToEsm = utils.dataToEsm;
448448

449449
it( 'outputs treeshakable data', function () {
450-
assert.equal( dataToNamedExports({ some: 'data', another: 'data' }), 'export const some = "data";\nexport const another = "data";\nexport default {\n some,\n another\n};' );
450+
assert.equal( dataToEsm({ some: 'data', another: 'data' }), 'export const some = "data";\nexport const another = "data";\nexport default {\n some,\n another\n};' );
451451
});
452452

453453
it( 'handles illegal identifiers', function () {
454-
assert.equal( dataToNamedExports({ '1': 'data', 'default': 'data' }), 'export const _1 = "data";\nexport const _default = "data";\nexport default {\n \'1\': _1,\n \'default\': _default\n};' );
454+
assert.equal( dataToEsm({ '1': 'data', 'default': 'data' }), 'export const _1 = "data";\nexport const _default = "data";\nexport default {\n \'1\': _1,\n \'default\': _default\n};' );
455455
});
456456

457457
it( 'supports non-JSON data', function () {
458458
const date = new Date();
459-
assert.equal( dataToNamedExports({ inf: Infinity, date: date }), 'export const inf = Infinity;\nexport const date = new Date(' + date.getTime() + ');\nexport default {\n inf,\n date\n};' );
459+
assert.equal( dataToEsm({ inf: Infinity, date: date }), 'export const inf = Infinity;\nexport const date = new Date(' + date.getTime() + ');\nexport default {\n inf,\n date\n};' );
460460
});
461461
});
462462
});

0 commit comments

Comments
 (0)