@magicspace/core
Advanced tools
Comparing version 0.2.8 to 0.2.9
import { File } from '../file'; | ||
import { Context } from './context'; | ||
export declare type ComposableModule = File.Composable<unknown, unknown> | File.Composable<unknown, unknown>[] | undefined | ComposableModuleFunction; | ||
export declare type ComposableModuleDefault = File.Composable<unknown, unknown> | File.Composable<unknown, unknown>[] | undefined | ComposableModuleFunction; | ||
export declare type ComposableModuleFunction = (options: Magicspace.TemplateOptions, context: Context) => File.Composable<unknown, unknown> | File.Composable<unknown, unknown>[] | undefined extends infer TReturn ? Promise<TReturn> | TReturn : never; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const Path = tslib_1.__importStar(require("path")); | ||
const tslib_2 = require("tslib"); | ||
const _constants_1 = require("../@constants"); | ||
@@ -107,5 +108,8 @@ const _git_1 = require("../@git"); | ||
for (let { path: composableModulePath, base: baseDir } of fileEntries) { | ||
let moduleDefault = tslib_2.__importDefault( | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires | ||
let module = require(composableModulePath); | ||
let composables = typeof module === 'function' ? await module(options, context) : module; | ||
require(composableModulePath)); | ||
let composables = typeof moduleDefault === 'function' | ||
? await moduleDefault(options, context) | ||
: moduleDefault; | ||
if (!composables) { | ||
@@ -112,0 +116,0 @@ continue; |
{ | ||
"name": "@magicspace/core", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"publishConfig": { | ||
@@ -36,3 +36,3 @@ "access": "public" | ||
}, | ||
"gitHead": "58f2dd6b063cbc95d78435195ce1fe06d826d8b9" | ||
"gitHead": "f57e414304b85557119f7fae97cc13a18b205540" | ||
} |
@@ -5,3 +5,3 @@ import {File} from '../file'; | ||
export type ComposableModule = | ||
export type ComposableModuleDefault = | ||
| File.Composable<unknown, unknown> | ||
@@ -8,0 +8,0 @@ | File.Composable<unknown, unknown>[] |
import * as Path from 'path'; | ||
import {__importDefault} from 'tslib'; | ||
import {TEMP_MAGIC_REPOSITORY_DIR} from '../@constants'; | ||
@@ -9,3 +11,3 @@ import {ProjectGit, Rename, TempGit} from '../@git'; | ||
import {ComposableModule} from './composable-module'; | ||
import {ComposableModuleDefault} from './composable-module'; | ||
import {Context} from './context'; | ||
@@ -175,7 +177,11 @@ | ||
for (let {path: composableModulePath, base: baseDir} of fileEntries) { | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires | ||
let module: ComposableModule = require(composableModulePath); | ||
let moduleDefault = __importDefault( | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires | ||
require(composableModulePath), | ||
) as ComposableModuleDefault; | ||
let composables = | ||
typeof module === 'function' ? await module(options, context) : module; | ||
typeof moduleDefault === 'function' | ||
? await moduleDefault(options, context) | ||
: moduleDefault; | ||
@@ -182,0 +188,0 @@ if (!composables) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117135
2464