Skip to content

Commit

Permalink
fix(package) Refactoring for use in current node version
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoublev committed Feb 12, 2021
1 parent fec4f7e commit 834727d
Show file tree
Hide file tree
Showing 19 changed files with 3,922 additions and 1,560 deletions.
2 changes: 1 addition & 1 deletion __tests__/animate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import animate from '../src/animate'
import animate from '../src/animate.js'

// SVG interfaces are not implement by jsdom
class SVGGeometryElement {}
Expand Down
8 changes: 4 additions & 4 deletions __tests__/animation.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import Animation from '../src/animation'
import { KeyframeEffect } from '../src/effect'
import { errors } from '../src/error'
import Animation from '../src/animation.js'
import { KeyframeEffect } from '../src/effect.js'
import { errors } from '../src/error.js'
import { performance } from 'perf_hooks'
import timeline from '../src/timeline'
import timeline from '../src/timeline.js'

const keyframes = { opacity: [0, 1] }
const target = document.createElement('a')
Expand Down
12 changes: 6 additions & 6 deletions __tests__/effect.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

import { AnimationEffect, KeyframeEffect, MotionPathEffect } from '../src/effect'
import { setStyle as set, setAttribute } from '../src/buffer'
import { NaNs } from './utils'
import { linear as easing } from '../src/easing'
import { errors } from '../src/error'
import { interpolateNumber as interpolate } from '../src/keyframe'
import { AnimationEffect, KeyframeEffect, MotionPathEffect } from '../src/effect.js'
import { setStyle as set, setAttribute } from '../src/buffer.js'
import { NaNs } from './utils.js'
import { linear as easing } from '../src/easing.js'
import { errors } from '../src/error.js'
import { interpolateNumber as interpolate } from '../src/keyframe.js'

// SVG interfaces are not implement by jsdom
class SVGGeometryElement {}
Expand Down
2 changes: 1 addition & 1 deletion __tests__/frame.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import frame from '../src/frame'
import frame from '../src/frame.js'

describe('frame', () => {
it('should cancel a request while satisfying other requests', async () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/getTemplateParts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { getTemplateParts } from '../src/keyframe'
import { getTemplateParts } from '../src/keyframe.js'

it('parses an input starting with a string and including numbers', () => {

Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { isFiniteNumber, isNumber } from '../src/utils'
import { isFiniteNumber, isNumber } from '../src/utils.js'

// eslint-disable-next-line jest/no-export
export const NaNs = [
Expand Down
47 changes: 29 additions & 18 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@

const config = {
exclude: /node_modules/,
plugins: [],
presets: [['@babel/preset-env', {
corejs: '3.8',
// debug: true,
targets: { node: true },
useBuiltIns: 'usage',
}]],
}
const plugins = [
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-private-property-in-object',
]

// ESLint requires plugins for proposals
if (process.env.NODE_ENV !== 'test') {
config.plugins.push(
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-private-property-in-object')
}
module.exports = api => {

const env = api.env()

module.exports = config
if (env === 'browser') {
return {
plugins,
presets: [['@babel/preset-env', { targets: { esmodules: true } }]],
}
}

return {
exclude: /node_modules/,
plugins,
presets: [['@babel/preset-env', {
corejs: '3.8',
modules: env === 'node' ? false : 'auto',
targets: env === 'development'
? { esmodules: true } // lint
: { node: true }, // build:node, test
useBuiltIns: 'usage',
}]],
}
}
Loading

0 comments on commit 834727d

Please sign in to comment.