aneka 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aneka",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "cemacemla",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -13,12 +13,13 @@ module.exports = async function (dir, transformer, options = {}) {
13
13
  const files = await fg(dir + '/*.{json,js}', options.glob)
14
14
  const strippeds = map(files, f => stripExt(f))
15
15
  const result = []
16
+ const me = this
16
17
  for (const file of files) {
17
18
  const stripped = stripExt(file)
18
19
  if (filter(strippeds, f => f === stripped).length > 1) throw new (`File '${stripped}.{json,js}' already used`)
19
20
  try {
20
21
  let mod = require(file)
21
- if (isFunction(mod)) mod = await mod.call(options.scope)
22
+ if (isFunction(mod)) mod = await mod.call(me, options)
22
23
  result.push(await transformer(file, mod, options.transformer))
23
24
  } catch (err) {
24
25
  throw err
@@ -4,9 +4,10 @@ const pathResolve = require('../fs/path-resolve')
4
4
 
5
5
  module.exports = async function (file, options) {
6
6
  const parsed = path.parse(pathResolve(file))
7
+ const me = this
7
8
  try {
8
9
  const mod = require(parsed.dir + '/' + parsed.name + '.js')
9
- if (isFunction(mod)) return await mod(options)
10
+ if (isFunction(mod)) return await mod.call(me, options)
10
11
  return mod
11
12
  } catch (err) {
12
13
  try {