@armoury/fivem-framework-common 1.0.12 → 1.0.13
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/dist/cjs/common/config.decorator.js +128 -0
- package/dist/cjs/common/index.js +29 -4
- package/dist/esm/common/config.decorator.js +123 -0
- package/dist/esm/common/index.js +27 -3
- package/dist/types/common/config.decorator.d.ts +5 -0
- package/dist/types/common/index.d.ts +3 -1
- package/package.json +6 -3
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = Config;
|
|
4
|
+
exports.createConfigProviders = createConfigProviders;
|
|
5
|
+
exports.parseConfigValue = parseConfigValue;
|
|
6
|
+
const injection_js_1 = require("injection-js");
|
|
7
|
+
const luaparse_1 = require("luaparse");
|
|
8
|
+
const CONFIG_PARAMETERS_METADATA = 'arm_config_parameters';
|
|
9
|
+
function Config(key, index = 0) {
|
|
10
|
+
if (!key.trim()) {
|
|
11
|
+
throw new Error('Config metadata key must not be empty.');
|
|
12
|
+
}
|
|
13
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
14
|
+
throw new Error('Config metadata index must be a non-negative integer.');
|
|
15
|
+
}
|
|
16
|
+
const token = new injection_js_1.InjectionToken(`Config(${key}, ${index})`);
|
|
17
|
+
const inject = (0, injection_js_1.Inject)(token);
|
|
18
|
+
return (target, propertyKey, parameterIndex) => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (propertyKey !== undefined) {
|
|
21
|
+
throw new Error('Config can only decorate constructor parameters.');
|
|
22
|
+
}
|
|
23
|
+
inject(target, propertyKey, parameterIndex);
|
|
24
|
+
const bindings = (_a = Reflect.getOwnMetadata(CONFIG_PARAMETERS_METADATA, target)) !== null && _a !== void 0 ? _a : [];
|
|
25
|
+
const binding = { token, key, index };
|
|
26
|
+
Reflect.defineMetadata(CONFIG_PARAMETERS_METADATA, [...bindings, binding], target);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function createConfigProviders(targets, readValue) {
|
|
30
|
+
var _a;
|
|
31
|
+
const bindings = new Map();
|
|
32
|
+
for (const target of targets) {
|
|
33
|
+
let constructor = target;
|
|
34
|
+
while (constructor && constructor !== Function.prototype) {
|
|
35
|
+
const constructorBindings = (_a = Reflect.getOwnMetadata(CONFIG_PARAMETERS_METADATA, constructor)) !== null && _a !== void 0 ? _a : [];
|
|
36
|
+
constructorBindings.forEach((binding) => bindings.set(binding.token, binding));
|
|
37
|
+
constructor = Object.getPrototypeOf(constructor);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return [...bindings.values()].map(({ token, key, index }) => ({
|
|
41
|
+
provide: token,
|
|
42
|
+
useFactory: () => {
|
|
43
|
+
const value = readValue(key, index);
|
|
44
|
+
if (value === null || value === undefined) {
|
|
45
|
+
throw new Error(`Missing resource metadata '${key}' at index ${index}.`);
|
|
46
|
+
}
|
|
47
|
+
return parseConfigValue(value, key);
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
function parseConfigValue(value, metadataKey) {
|
|
52
|
+
let expression = value.trim();
|
|
53
|
+
const metadataCallPrefix = new RegExp(`^${escapeRegExp(metadataKey)}\\s+`);
|
|
54
|
+
expression = expression.replace(metadataCallPrefix, '');
|
|
55
|
+
if (expression.startsWith('{') || expression.startsWith('[')) {
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(expression);
|
|
58
|
+
}
|
|
59
|
+
catch (_a) {
|
|
60
|
+
// Resource manifest tables use Lua syntax rather than JSON.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (!expression.startsWith('return')) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
const chunk = (0, luaparse_1.parse)(expression.startsWith('return') ? expression : `return ${expression}`, {
|
|
67
|
+
luaVersion: '5.3',
|
|
68
|
+
});
|
|
69
|
+
const statement = chunk.body[0];
|
|
70
|
+
if (chunk.body.length !== 1 || statement.type !== 'ReturnStatement' || statement.arguments.length !== 1) {
|
|
71
|
+
throw new Error(`Resource metadata '${metadataKey}' must contain a single table value.`);
|
|
72
|
+
}
|
|
73
|
+
return convertLuaExpression(statement.arguments[0], metadataKey);
|
|
74
|
+
}
|
|
75
|
+
function convertLuaExpression(expression, metadataKey) {
|
|
76
|
+
switch (expression.type) {
|
|
77
|
+
case 'TableConstructorExpression':
|
|
78
|
+
return convertLuaTable(expression, metadataKey);
|
|
79
|
+
case 'StringLiteral':
|
|
80
|
+
case 'NumericLiteral':
|
|
81
|
+
case 'BooleanLiteral':
|
|
82
|
+
case 'NilLiteral':
|
|
83
|
+
return expression.value;
|
|
84
|
+
case 'UnaryExpression':
|
|
85
|
+
if (expression.operator === '-' && expression.argument.type === 'NumericLiteral') {
|
|
86
|
+
return -expression.argument.value;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Resource metadata '${metadataKey}' contains an unsupported Lua expression.`);
|
|
91
|
+
}
|
|
92
|
+
function convertLuaTable(table, metadataKey) {
|
|
93
|
+
if (table.fields.every((field) => field.type === 'TableValue')) {
|
|
94
|
+
return table.fields.map((field) => convertLuaExpression(field.value, metadataKey));
|
|
95
|
+
}
|
|
96
|
+
const result = {};
|
|
97
|
+
let nextArrayIndex = 1;
|
|
98
|
+
for (const field of table.fields) {
|
|
99
|
+
let key;
|
|
100
|
+
let value;
|
|
101
|
+
if (field.type === 'TableKeyString') {
|
|
102
|
+
key = field.key.name;
|
|
103
|
+
value = field.value;
|
|
104
|
+
}
|
|
105
|
+
else if (field.type === 'TableKey') {
|
|
106
|
+
const parsedKey = convertLuaExpression(field.key, metadataKey);
|
|
107
|
+
if (typeof parsedKey !== 'string' && typeof parsedKey !== 'number') {
|
|
108
|
+
throw new Error(`Resource metadata '${metadataKey}' has an unsupported table key.`);
|
|
109
|
+
}
|
|
110
|
+
key = String(parsedKey);
|
|
111
|
+
value = field.value;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
key = String(nextArrayIndex++);
|
|
115
|
+
value = field.value;
|
|
116
|
+
}
|
|
117
|
+
Object.defineProperty(result, key, {
|
|
118
|
+
value: convertLuaExpression(value, metadataKey),
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true,
|
|
121
|
+
writable: true,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
function escapeRegExp(value) {
|
|
127
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
128
|
+
}
|
package/dist/cjs/common/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.APP_INITIALIZER = exports.DecorationType = exports.Decorate = void 0;
|
|
18
|
+
exports.APP_INITIALIZER = exports.Config = exports.DecorationType = exports.Decorate = void 0;
|
|
19
19
|
exports.bootstrapWithProviders = bootstrapWithProviders;
|
|
20
20
|
require("reflect-metadata");
|
|
21
21
|
const injection_js_1 = require("injection-js");
|
|
@@ -26,14 +26,39 @@ Object.defineProperty(exports, "Decorate", { enumerable: true, get: function ()
|
|
|
26
26
|
Object.defineProperty(exports, "DecorationType", { enumerable: true, get: function () { return decorator_utils_1.DecorationType; } });
|
|
27
27
|
__exportStar(require("../utils"), exports);
|
|
28
28
|
__exportStar(require("../utils/utils"), exports);
|
|
29
|
+
var config_decorator_1 = require("./config.decorator");
|
|
30
|
+
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_decorator_1.Config; } });
|
|
29
31
|
const decorator_utils_2 = require("../decorators/decorator.utils");
|
|
32
|
+
const config_decorator_2 = require("./config.decorator");
|
|
30
33
|
exports.APP_INITIALIZER = new injection_js_1.InjectionToken('APP_INITIALIZER');
|
|
31
|
-
|
|
34
|
+
function getProviderClasses(providers) {
|
|
35
|
+
const classes = [];
|
|
36
|
+
for (const provider of providers) {
|
|
37
|
+
if (Array.isArray(provider)) {
|
|
38
|
+
classes.push(...getProviderClasses(provider));
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (typeof provider === 'function') {
|
|
42
|
+
classes.push(provider);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (provider && typeof provider === 'object' && 'useClass' in provider) {
|
|
46
|
+
classes.push(provider.useClass);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return classes;
|
|
50
|
+
}
|
|
51
|
+
async function bootstrapWithProviders(entryPoint, parentProviders, options = {}, decorationType = decorator_utils_2.DecorationType.SERVER, readConfigValue) {
|
|
32
52
|
var _a, _b;
|
|
33
53
|
const eagerProviders = (_a = options.eager) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
const providers = [
|
|
54
|
+
const providers = [
|
|
55
|
+
...((_b = options.providers) !== null && _b !== void 0 ? _b : []),
|
|
56
|
+
...eagerProviders,
|
|
57
|
+
];
|
|
58
|
+
const configTargets = [entryPoint, ...getProviderClasses(parentProviders), ...getProviderClasses(providers)];
|
|
59
|
+
const configProviders = (0, config_decorator_2.createConfigProviders)(configTargets, readConfigValue);
|
|
35
60
|
const parentInjector = injection_js_1.ReflectiveInjector.resolveAndCreate(parentProviders);
|
|
36
|
-
const injector = injection_js_1.ReflectiveInjector.resolveAndCreate([...providers, entryPoint], parentInjector);
|
|
61
|
+
const injector = injection_js_1.ReflectiveInjector.resolveAndCreate([...configProviders, ...providers, entryPoint], parentInjector);
|
|
37
62
|
const instance = injector.get(entryPoint);
|
|
38
63
|
(0, decorator_utils_2.Decorate)(instance, entryPoint.prototype, [...parentProviders, ...providers], decorationType);
|
|
39
64
|
eagerProviders.forEach((provider) => injector.get(provider));
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Inject, InjectionToken } from 'injection-js';
|
|
2
|
+
import { parse as parseLua } from 'luaparse';
|
|
3
|
+
const CONFIG_PARAMETERS_METADATA = 'arm_config_parameters';
|
|
4
|
+
export function Config(key, index = 0) {
|
|
5
|
+
if (!key.trim()) {
|
|
6
|
+
throw new Error('Config metadata key must not be empty.');
|
|
7
|
+
}
|
|
8
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
9
|
+
throw new Error('Config metadata index must be a non-negative integer.');
|
|
10
|
+
}
|
|
11
|
+
const token = new InjectionToken(`Config(${key}, ${index})`);
|
|
12
|
+
const inject = Inject(token);
|
|
13
|
+
return (target, propertyKey, parameterIndex) => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (propertyKey !== undefined) {
|
|
16
|
+
throw new Error('Config can only decorate constructor parameters.');
|
|
17
|
+
}
|
|
18
|
+
inject(target, propertyKey, parameterIndex);
|
|
19
|
+
const bindings = (_a = Reflect.getOwnMetadata(CONFIG_PARAMETERS_METADATA, target)) !== null && _a !== void 0 ? _a : [];
|
|
20
|
+
const binding = { token, key, index };
|
|
21
|
+
Reflect.defineMetadata(CONFIG_PARAMETERS_METADATA, [...bindings, binding], target);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function createConfigProviders(targets, readValue) {
|
|
25
|
+
var _a;
|
|
26
|
+
const bindings = new Map();
|
|
27
|
+
for (const target of targets) {
|
|
28
|
+
let constructor = target;
|
|
29
|
+
while (constructor && constructor !== Function.prototype) {
|
|
30
|
+
const constructorBindings = (_a = Reflect.getOwnMetadata(CONFIG_PARAMETERS_METADATA, constructor)) !== null && _a !== void 0 ? _a : [];
|
|
31
|
+
constructorBindings.forEach((binding) => bindings.set(binding.token, binding));
|
|
32
|
+
constructor = Object.getPrototypeOf(constructor);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return [...bindings.values()].map(({ token, key, index }) => ({
|
|
36
|
+
provide: token,
|
|
37
|
+
useFactory: () => {
|
|
38
|
+
const value = readValue(key, index);
|
|
39
|
+
if (value === null || value === undefined) {
|
|
40
|
+
throw new Error(`Missing resource metadata '${key}' at index ${index}.`);
|
|
41
|
+
}
|
|
42
|
+
return parseConfigValue(value, key);
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
export function parseConfigValue(value, metadataKey) {
|
|
47
|
+
let expression = value.trim();
|
|
48
|
+
const metadataCallPrefix = new RegExp(`^${escapeRegExp(metadataKey)}\\s+`);
|
|
49
|
+
expression = expression.replace(metadataCallPrefix, '');
|
|
50
|
+
if (expression.startsWith('{') || expression.startsWith('[')) {
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(expression);
|
|
53
|
+
}
|
|
54
|
+
catch (_a) {
|
|
55
|
+
// Resource manifest tables use Lua syntax rather than JSON.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (!expression.startsWith('return')) {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
const chunk = parseLua(expression.startsWith('return') ? expression : `return ${expression}`, {
|
|
62
|
+
luaVersion: '5.3',
|
|
63
|
+
});
|
|
64
|
+
const statement = chunk.body[0];
|
|
65
|
+
if (chunk.body.length !== 1 || statement.type !== 'ReturnStatement' || statement.arguments.length !== 1) {
|
|
66
|
+
throw new Error(`Resource metadata '${metadataKey}' must contain a single table value.`);
|
|
67
|
+
}
|
|
68
|
+
return convertLuaExpression(statement.arguments[0], metadataKey);
|
|
69
|
+
}
|
|
70
|
+
function convertLuaExpression(expression, metadataKey) {
|
|
71
|
+
switch (expression.type) {
|
|
72
|
+
case 'TableConstructorExpression':
|
|
73
|
+
return convertLuaTable(expression, metadataKey);
|
|
74
|
+
case 'StringLiteral':
|
|
75
|
+
case 'NumericLiteral':
|
|
76
|
+
case 'BooleanLiteral':
|
|
77
|
+
case 'NilLiteral':
|
|
78
|
+
return expression.value;
|
|
79
|
+
case 'UnaryExpression':
|
|
80
|
+
if (expression.operator === '-' && expression.argument.type === 'NumericLiteral') {
|
|
81
|
+
return -expression.argument.value;
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`Resource metadata '${metadataKey}' contains an unsupported Lua expression.`);
|
|
86
|
+
}
|
|
87
|
+
function convertLuaTable(table, metadataKey) {
|
|
88
|
+
if (table.fields.every((field) => field.type === 'TableValue')) {
|
|
89
|
+
return table.fields.map((field) => convertLuaExpression(field.value, metadataKey));
|
|
90
|
+
}
|
|
91
|
+
const result = {};
|
|
92
|
+
let nextArrayIndex = 1;
|
|
93
|
+
for (const field of table.fields) {
|
|
94
|
+
let key;
|
|
95
|
+
let value;
|
|
96
|
+
if (field.type === 'TableKeyString') {
|
|
97
|
+
key = field.key.name;
|
|
98
|
+
value = field.value;
|
|
99
|
+
}
|
|
100
|
+
else if (field.type === 'TableKey') {
|
|
101
|
+
const parsedKey = convertLuaExpression(field.key, metadataKey);
|
|
102
|
+
if (typeof parsedKey !== 'string' && typeof parsedKey !== 'number') {
|
|
103
|
+
throw new Error(`Resource metadata '${metadataKey}' has an unsupported table key.`);
|
|
104
|
+
}
|
|
105
|
+
key = String(parsedKey);
|
|
106
|
+
value = field.value;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
key = String(nextArrayIndex++);
|
|
110
|
+
value = field.value;
|
|
111
|
+
}
|
|
112
|
+
Object.defineProperty(result, key, {
|
|
113
|
+
value: convertLuaExpression(value, metadataKey),
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
function escapeRegExp(value) {
|
|
122
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
123
|
+
}
|
package/dist/esm/common/index.js
CHANGED
|
@@ -6,14 +6,38 @@ export * from '../decorators';
|
|
|
6
6
|
export { Decorate, DecorationType } from '../decorators/decorator.utils';
|
|
7
7
|
export * from '../utils';
|
|
8
8
|
export * from '../utils/utils';
|
|
9
|
+
export { Config } from './config.decorator';
|
|
9
10
|
import { Decorate, DecorationType } from '../decorators/decorator.utils';
|
|
11
|
+
import { createConfigProviders } from './config.decorator';
|
|
10
12
|
export const APP_INITIALIZER = new InjectionToken('APP_INITIALIZER');
|
|
11
|
-
|
|
13
|
+
function getProviderClasses(providers) {
|
|
14
|
+
const classes = [];
|
|
15
|
+
for (const provider of providers) {
|
|
16
|
+
if (Array.isArray(provider)) {
|
|
17
|
+
classes.push(...getProviderClasses(provider));
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (typeof provider === 'function') {
|
|
21
|
+
classes.push(provider);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (provider && typeof provider === 'object' && 'useClass' in provider) {
|
|
25
|
+
classes.push(provider.useClass);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return classes;
|
|
29
|
+
}
|
|
30
|
+
export async function bootstrapWithProviders(entryPoint, parentProviders, options = {}, decorationType = DecorationType.SERVER, readConfigValue) {
|
|
12
31
|
var _a, _b;
|
|
13
32
|
const eagerProviders = (_a = options.eager) !== null && _a !== void 0 ? _a : [];
|
|
14
|
-
const providers = [
|
|
33
|
+
const providers = [
|
|
34
|
+
...((_b = options.providers) !== null && _b !== void 0 ? _b : []),
|
|
35
|
+
...eagerProviders,
|
|
36
|
+
];
|
|
37
|
+
const configTargets = [entryPoint, ...getProviderClasses(parentProviders), ...getProviderClasses(providers)];
|
|
38
|
+
const configProviders = createConfigProviders(configTargets, readConfigValue);
|
|
15
39
|
const parentInjector = ReflectiveInjector.resolveAndCreate(parentProviders);
|
|
16
|
-
const injector = ReflectiveInjector.resolveAndCreate([...providers, entryPoint], parentInjector);
|
|
40
|
+
const injector = ReflectiveInjector.resolveAndCreate([...configProviders, ...providers, entryPoint], parentInjector);
|
|
17
41
|
const instance = injector.get(entryPoint);
|
|
18
42
|
Decorate(instance, entryPoint.prototype, [...parentProviders, ...providers], decorationType);
|
|
19
43
|
eagerProviders.forEach((provider) => injector.get(provider));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Provider } from 'injection-js';
|
|
2
|
+
export type ConfigValueReader = (key: string, index: number) => string | null | undefined;
|
|
3
|
+
export declare function Config<T = unknown>(key: string, index?: number): ParameterDecorator;
|
|
4
|
+
export declare function createConfigProviders(targets: Function[], readValue: ConfigValueReader): Provider[];
|
|
5
|
+
export declare function parseConfigValue(value: string, metadataKey: string): unknown;
|
|
@@ -5,7 +5,9 @@ export * from '../decorators';
|
|
|
5
5
|
export { Decorate, DecorationType } from '../decorators/decorator.utils';
|
|
6
6
|
export * from '../utils';
|
|
7
7
|
export * from '../utils/utils';
|
|
8
|
+
export { Config } from './config.decorator';
|
|
8
9
|
import { DecorationType } from '../decorators/decorator.utils';
|
|
10
|
+
import { ConfigValueReader } from './config.decorator';
|
|
9
11
|
export type AppInitializer = () => void | Promise<void>;
|
|
10
12
|
export declare const APP_INITIALIZER: InjectionToken<AppInitializer[]>;
|
|
11
13
|
export interface BootstrapOptions {
|
|
@@ -16,4 +18,4 @@ export interface BootstrapOptions {
|
|
|
16
18
|
}
|
|
17
19
|
export declare function bootstrapWithProviders<T extends {
|
|
18
20
|
new (...args: any[]): any;
|
|
19
|
-
} & Provider>(entryPoint: T, parentProviders: Provider[], options
|
|
21
|
+
} & Provider>(entryPoint: T, parentProviders: Provider[], options: BootstrapOptions | undefined, decorationType: DecorationType | undefined, readConfigValue: ConfigValueReader): Promise<InstanceType<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armoury/fivem-framework-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Shared APIs for the Armoury FiveM framework",
|
|
5
5
|
"main": "dist/cjs/common/index.js",
|
|
6
6
|
"module": "dist/esm/common/index.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"require": "./dist/cjs/common/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"files": [
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
16
18
|
"scripts": {
|
|
17
19
|
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
18
20
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -21,9 +23,10 @@
|
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"injection-js": "^2.4.0",
|
|
26
|
+
"luaparse": "^0.3.1",
|
|
24
27
|
"reflect-metadata": "^0.2.1"
|
|
25
28
|
},
|
|
26
29
|
"publishConfig": {
|
|
27
30
|
"access": "public"
|
|
28
31
|
}
|
|
29
|
-
}
|
|
32
|
+
}
|