@intlayer/core 5.5.0-canary.0 → 5.5.1
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.
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,23 +17,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var file_exports = {};
|
|
20
30
|
__export(file_exports, {
|
|
21
31
|
file: () => file
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(file_exports);
|
|
34
|
+
var import_config = require("@intlayer/config");
|
|
35
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
24
36
|
var import_fs = require("fs");
|
|
25
|
-
var import_types = require('../../types/index.cjs');
|
|
26
37
|
var import_path = require("path");
|
|
27
|
-
var
|
|
38
|
+
var import_types = require('../../types/index.cjs');
|
|
28
39
|
const file = (path) => {
|
|
29
40
|
const callerDir = intlayer_file_dir ?? process.cwd();
|
|
30
41
|
const isAbsolutePath = path.startsWith("/");
|
|
31
42
|
const isRelativePath = path.startsWith("./") || path.startsWith("../");
|
|
43
|
+
const appLogger = (0, import_config.getAppLogger)(import_built.default);
|
|
32
44
|
let filePath;
|
|
33
45
|
if (isAbsolutePath) {
|
|
34
|
-
|
|
46
|
+
appLogger(
|
|
35
47
|
`Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${intlayer_file_path}`,
|
|
36
48
|
{ level: "warn" }
|
|
37
49
|
);
|
|
@@ -45,7 +57,7 @@ const file = (path) => {
|
|
|
45
57
|
if ((0, import_fs.existsSync)(filePath)) {
|
|
46
58
|
content = (0, import_fs.readFileSync)(filePath, "utf8");
|
|
47
59
|
} else {
|
|
48
|
-
|
|
60
|
+
appLogger(`File not found: ${filePath}`, { level: "warn" });
|
|
49
61
|
content = `File not found`;
|
|
50
62
|
}
|
|
51
63
|
return (0, import_types.formatNodeType)(import_types.NodeType.File, path, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { existsSync, readFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport {\n formatNodeType,\n NodeType,\n type TypedNodeModel,\n} from '../../types/index';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<NodeType.File, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\ndeclare const intlayer_file_path: string; // Injected by esbuild to track the file content\ndeclare const intlayer_file_dir: string; // Injected by esbuild to track the file path\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const callerDir = intlayer_file_dir ?? process.cwd();\n\n const isAbsolutePath = path.startsWith('/');\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger(configuration);\n\n let filePath: string;\n if (isAbsolutePath) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${intlayer_file_path}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(process.cwd(), path);\n }\n\n let content: string;\n\n if (existsSync(filePath)) {\n content = readFileSync(filePath, 'utf8');\n } else {\n appLogger(`File not found: ${filePath}`, { level: 'warn' });\n\n content = `File not found`;\n }\n\n return formatNodeType(NodeType.File, path, {\n content,\n fixedPath: relative(process.cwd(), filePath),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,mBAA0B;AAC1B,gBAAyC;AACzC,kBAAkC;AAClC,mBAIO;AA4BA,MAAM,OAAO,CAAC,SAA8B;AACjD,QAAM,YAAY,qBAAqB,QAAQ,IAAI;AAEnD,QAAM,iBAAiB,KAAK,WAAW,GAAG;AAC1C,QAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;AACrE,QAAM,gBAAY,4BAAa,aAAAA,OAAa;AAE5C,MAAI;AACJ,MAAI,gBAAgB;AAClB;AAAA,MACE,sFAAsF,IAAI,oBAAoB,kBAAkB;AAAA,MAChI,EAAE,OAAO,OAAO;AAAA,IAClB;AACA,eAAW;AAAA,EACb,WAAW,gBAAgB;AACzB,mBAAW,qBAAQ,WAAW,IAAI;AAAA,EACpC,OAAO;AACL,mBAAW,qBAAQ,QAAQ,IAAI,GAAG,IAAI;AAAA,EACxC;AAEA,MAAI;AAEJ,UAAI,sBAAW,QAAQ,GAAG;AACxB,kBAAU,wBAAa,UAAU,MAAM;AAAA,EACzC,OAAO;AACL,cAAU,mBAAmB,QAAQ,IAAI,EAAE,OAAO,OAAO,CAAC;AAE1D,cAAU;AAAA,EACZ;AAEA,aAAO,6BAAe,sBAAS,MAAM,MAAM;AAAA,IACzC;AAAA,IACA,eAAW,sBAAS,QAAQ,IAAI,GAAG,QAAQ;AAAA,EAC7C,CAAC;AACH;","names":["configuration"]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { getAppLogger } from "@intlayer/config";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
1
3
|
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
import { relative, resolve } from "path";
|
|
2
5
|
import {
|
|
3
6
|
formatNodeType,
|
|
4
7
|
NodeType
|
|
5
8
|
} from "../../types/index.mjs";
|
|
6
|
-
import { relative, resolve } from "path";
|
|
7
|
-
import { appLogger } from "@intlayer/config";
|
|
8
9
|
const file = (path) => {
|
|
9
10
|
const callerDir = intlayer_file_dir ?? process.cwd();
|
|
10
11
|
const isAbsolutePath = path.startsWith("/");
|
|
11
12
|
const isRelativePath = path.startsWith("./") || path.startsWith("../");
|
|
13
|
+
const appLogger = getAppLogger(configuration);
|
|
12
14
|
let filePath;
|
|
13
15
|
if (isAbsolutePath) {
|
|
14
16
|
appLogger(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { existsSync, readFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport {\n formatNodeType,\n NodeType,\n type TypedNodeModel,\n} from '../../types/index';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<NodeType.File, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\ndeclare const intlayer_file_path: string; // Injected by esbuild to track the file content\ndeclare const intlayer_file_dir: string; // Injected by esbuild to track the file path\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const callerDir = intlayer_file_dir ?? process.cwd();\n\n const isAbsolutePath = path.startsWith('/');\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger(configuration);\n\n let filePath: string;\n if (isAbsolutePath) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${intlayer_file_path}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(process.cwd(), path);\n }\n\n let content: string;\n\n if (existsSync(filePath)) {\n content = readFileSync(filePath, 'utf8');\n } else {\n appLogger(`File not found: ${filePath}`, { level: 'warn' });\n\n content = `File not found`;\n }\n\n return formatNodeType(NodeType.File, path, {\n content,\n fixedPath: relative(process.cwd(), filePath),\n });\n};\n"],"mappings":"AAAA,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAC1B,SAAS,YAAY,oBAAoB;AACzC,SAAS,UAAU,eAAe;AAClC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AA4BA,MAAM,OAAO,CAAC,SAA8B;AACjD,QAAM,YAAY,qBAAqB,QAAQ,IAAI;AAEnD,QAAM,iBAAiB,KAAK,WAAW,GAAG;AAC1C,QAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;AACrE,QAAM,YAAY,aAAa,aAAa;AAE5C,MAAI;AACJ,MAAI,gBAAgB;AAClB;AAAA,MACE,sFAAsF,IAAI,oBAAoB,kBAAkB;AAAA,MAChI,EAAE,OAAO,OAAO;AAAA,IAClB;AACA,eAAW;AAAA,EACb,WAAW,gBAAgB;AACzB,eAAW,QAAQ,WAAW,IAAI;AAAA,EACpC,OAAO;AACL,eAAW,QAAQ,QAAQ,IAAI,GAAG,IAAI;AAAA,EACxC;AAEA,MAAI;AAEJ,MAAI,WAAW,QAAQ,GAAG;AACxB,cAAU,aAAa,UAAU,MAAM;AAAA,EACzC,OAAO;AACL,cAAU,mBAAmB,QAAQ,IAAI,EAAE,OAAO,OAAO,CAAC;AAE1D,cAAU;AAAA,EACZ;AAEA,SAAO,eAAe,SAAS,MAAM,MAAM;AAAA,IACzC;AAAA,IACA,WAAW,SAAS,QAAQ,IAAI,GAAG,QAAQ;AAAA,EAC7C,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/file/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/file/file.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,QAAQ,EACR,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,IACnE,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,sBAAsB,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAKH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,WAkCnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"negotiator": "^1.0.0",
|
|
78
|
-
"@intlayer/api": "5.5.
|
|
79
|
-
"@intlayer/
|
|
80
|
-
"@intlayer/
|
|
78
|
+
"@intlayer/api": "5.5.1",
|
|
79
|
+
"@intlayer/dictionaries-entry": "5.5.1",
|
|
80
|
+
"@intlayer/config": "5.5.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@types/negotiator": "^0.6.3",
|
|
@@ -91,15 +91,15 @@
|
|
|
91
91
|
"tsup": "^8.4.0",
|
|
92
92
|
"typescript": "^5.8.2",
|
|
93
93
|
"@utils/eslint-config": "1.0.4",
|
|
94
|
-
"@utils/ts-config-types": "1.0.4",
|
|
95
94
|
"@utils/ts-config": "1.0.4",
|
|
95
|
+
"@utils/ts-config-types": "1.0.4",
|
|
96
96
|
"@utils/tsup-config": "1.0.4"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@intlayer/api": "5.5.
|
|
100
|
-
"intlayer": "5.5.
|
|
101
|
-
"@intlayer/dictionaries-entry": "5.5.
|
|
102
|
-
"
|
|
99
|
+
"@intlayer/api": "5.5.1",
|
|
100
|
+
"@intlayer/config": "5.5.1",
|
|
101
|
+
"@intlayer/dictionaries-entry": "5.5.1",
|
|
102
|
+
"intlayer": "5.5.1"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=14.18"
|