-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import memory from './memory' | ||
export default function flush () { | ||
|
||
export default function flush() { | ||
const ret = {} | ||
for (let i in memory) { | ||
|
||
for (const i in memory) { | ||
if (!{}.hasOwnProperty.call(memory, i)) { | ||
continue | ||
} | ||
|
||
ret[i] = memory[i] | ||
delete memory[i] | ||
} | ||
|
||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { resolve } from 'path' | ||
import { readFile } from 'fs-promise' | ||
import {resolve} from 'path' | ||
import {readFile} from 'fs-promise' | ||
|
||
export default async (path) => { | ||
export default async path => { | ||
const buffer = await readFile(resolve(__dirname, path)) | ||
return buffer.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,43 @@ | ||
import test from 'ava' | ||
// Native | ||
import path from 'path' | ||
import read from './_read' | ||
|
||
// Packages | ||
import test from 'ava' | ||
import {transformFile} from 'babel-core' | ||
|
||
// Ours | ||
import plugin from '../babel' | ||
import { transformFile } from 'babel-core' | ||
import read from './_read' | ||
|
||
const transform = (file) => ( | ||
const transform = file => ( | ||
new Promise((resolve, reject) => { | ||
transformFile(path.resolve(__dirname, file), { | ||
plugins: [ | ||
plugin | ||
] | ||
}, function (err, data) { | ||
if (err) return reject(err) | ||
}, (err, data) => { | ||
if (err) { | ||
return reject(err) | ||
} | ||
resolve(data) | ||
}) | ||
}) | ||
) | ||
|
||
test('works with stateless', async (t) => { | ||
const { code } = await transform('./fixtures/stateless.js') | ||
test('works with stateless', async t => { | ||
const {code} = await transform('./fixtures/stateless.js') | ||
const out = await read('./fixtures/stateless.out.js') | ||
t.is(code, out.trim()) | ||
}) | ||
|
||
test('works with class', async (t) => { | ||
const { code } = await transform('./fixtures/class.js') | ||
test('works with class', async t => { | ||
const {code} = await transform('./fixtures/class.js') | ||
const out = await read('./fixtures/class.out.js') | ||
t.is(code, out.trim()) | ||
}) | ||
|
||
test('ignores when attribute is absent', async (t) => { | ||
const { code } = await transform('./fixtures/absent.js') | ||
test('ignores when attribute is absent', async t => { | ||
const {code} = await transform('./fixtures/absent.js') | ||
const out = await read('./fixtures/absent.out.js') | ||
t.is(code, out.trim()) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
// Packages | ||
import test from 'ava' | ||
import read from './_read' | ||
|
||
// Ours | ||
import transform from '../lib/style-transform' | ||
import read from './_read' | ||
|
||
test('transpile styles with attributes', async (t) => { | ||
test('transpile styles with attributes', async t => { | ||
const src = await read('./fixtures/transform.css') | ||
const out = await read('./fixtures/transform.out.css') | ||
|
||
t.is(transform('woot', src), out.trim()) | ||
}) |