@gravity-ui/data-source 0.10.0-alpha.6 → 0.10.0-alpha.7
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/build/plugin/esbuild.cjs +1 -1
- package/build/plugin/esbuild.mjs +1 -1
- package/build/plugin/{factory-CIwgQy1N.cjs → factory-Dq6kUGl-.cjs} +11 -3
- package/build/plugin/{factory-C-n_7Tjo.mjs → factory-Ds3_-8kv.mjs} +11 -3
- package/build/plugin/index.cjs +1 -1
- package/build/plugin/index.mjs +1 -1
- package/build/plugin/rollup.cjs +1 -1
- package/build/plugin/rollup.mjs +1 -1
- package/build/plugin/rspack.cjs +1 -1
- package/build/plugin/rspack.mjs +1 -1
- package/build/plugin/vite.cjs +1 -1
- package/build/plugin/vite.mjs +1 -1
- package/build/plugin/webpack.cjs +1 -1
- package/build/plugin/webpack.mjs +1 -1
- package/package.json +1 -1
package/build/plugin/esbuild.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_factory = require("./factory-
|
|
1
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
2
2
|
//#region src/plugin/esbuild.ts
|
|
3
3
|
var esbuild_default = (0, require("unplugin").createEsbuildPlugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
4
4
|
//#endregion
|
package/build/plugin/esbuild.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createEsbuildPlugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/esbuild.ts
|
|
4
4
|
var esbuild_default = createEsbuildPlugin(dataSourceLazyUnpluginFactory);
|
|
@@ -82,6 +82,14 @@ function parseCompanionId(id) {
|
|
|
82
82
|
function isRelativeId(id) {
|
|
83
83
|
return id[0] === ".";
|
|
84
84
|
}
|
|
85
|
+
function toRelativeImportSource(fromFile, toFile) {
|
|
86
|
+
const fromDir = node_path.default.dirname(stripQuery(fromFile));
|
|
87
|
+
let rel = node_path.default.relative(fromDir, toFile);
|
|
88
|
+
if (node_path.default.sep !== "/") rel = rel.split(node_path.default.sep).join("/");
|
|
89
|
+
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
90
|
+
const ext = node_path.default.extname(rel);
|
|
91
|
+
return ext ? rel.slice(0, -ext.length) : rel;
|
|
92
|
+
}
|
|
85
93
|
function stripQuery(id) {
|
|
86
94
|
const queryIndex = id.indexOf("?");
|
|
87
95
|
return queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
@@ -461,9 +469,9 @@ function transformDefinitionModule(s, filename, info) {
|
|
|
461
469
|
function transformUsages(s, usages) {
|
|
462
470
|
for (const { usage } of usages) for (const access of usage.accesses) s.overwrite(access.start, access.end, `${usage.spec.localName}${access.prop}`);
|
|
463
471
|
const newImports = [];
|
|
464
|
-
for (const { usage,
|
|
472
|
+
for (const { usage, hocImportSource, hocExportedName } of usages) {
|
|
465
473
|
const propsUsed = new Set(usage.accesses.map((access) => access.prop));
|
|
466
|
-
for (const prop of propsUsed) newImports.push(renderNamedImport(`${usage.spec.localName}${prop}`, `${hocExportedName}${prop}`, makeCompanionId(COMPANION_TYPE_BY_SUFFIX[prop],
|
|
474
|
+
for (const prop of propsUsed) newImports.push(renderNamedImport(`${usage.spec.localName}${prop}`, `${hocExportedName}${prop}`, makeCompanionId(COMPANION_TYPE_BY_SUFFIX[prop], hocImportSource)));
|
|
467
475
|
}
|
|
468
476
|
if (newImports.length > 0) s.prepend(newImports.join("\n") + "\n");
|
|
469
477
|
const localsByDecl = /* @__PURE__ */ new Map();
|
|
@@ -605,7 +613,7 @@ const dataSourceLazyUnpluginFactory = (options = {}) => {
|
|
|
605
613
|
if (!target) return null;
|
|
606
614
|
return {
|
|
607
615
|
usage,
|
|
608
|
-
|
|
616
|
+
hocImportSource: toRelativeImportSource(id, target.file),
|
|
609
617
|
hocExportedName: target.info.exportedName
|
|
610
618
|
};
|
|
611
619
|
}))).filter((usage) => usage !== null);
|
|
@@ -57,6 +57,14 @@ function parseCompanionId(id) {
|
|
|
57
57
|
function isRelativeId(id) {
|
|
58
58
|
return id[0] === ".";
|
|
59
59
|
}
|
|
60
|
+
function toRelativeImportSource(fromFile, toFile) {
|
|
61
|
+
const fromDir = path.dirname(stripQuery(fromFile));
|
|
62
|
+
let rel = path.relative(fromDir, toFile);
|
|
63
|
+
if (path.sep !== "/") rel = rel.split(path.sep).join("/");
|
|
64
|
+
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
65
|
+
const ext = path.extname(rel);
|
|
66
|
+
return ext ? rel.slice(0, -ext.length) : rel;
|
|
67
|
+
}
|
|
60
68
|
function stripQuery(id) {
|
|
61
69
|
const queryIndex = id.indexOf("?");
|
|
62
70
|
return queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
@@ -436,9 +444,9 @@ function transformDefinitionModule(s, filename, info) {
|
|
|
436
444
|
function transformUsages(s, usages) {
|
|
437
445
|
for (const { usage } of usages) for (const access of usage.accesses) s.overwrite(access.start, access.end, `${usage.spec.localName}${access.prop}`);
|
|
438
446
|
const newImports = [];
|
|
439
|
-
for (const { usage,
|
|
447
|
+
for (const { usage, hocImportSource, hocExportedName } of usages) {
|
|
440
448
|
const propsUsed = new Set(usage.accesses.map((access) => access.prop));
|
|
441
|
-
for (const prop of propsUsed) newImports.push(renderNamedImport(`${usage.spec.localName}${prop}`, `${hocExportedName}${prop}`, makeCompanionId(COMPANION_TYPE_BY_SUFFIX[prop],
|
|
449
|
+
for (const prop of propsUsed) newImports.push(renderNamedImport(`${usage.spec.localName}${prop}`, `${hocExportedName}${prop}`, makeCompanionId(COMPANION_TYPE_BY_SUFFIX[prop], hocImportSource)));
|
|
442
450
|
}
|
|
443
451
|
if (newImports.length > 0) s.prepend(newImports.join("\n") + "\n");
|
|
444
452
|
const localsByDecl = /* @__PURE__ */ new Map();
|
|
@@ -580,7 +588,7 @@ const dataSourceLazyUnpluginFactory = (options = {}) => {
|
|
|
580
588
|
if (!target) return null;
|
|
581
589
|
return {
|
|
582
590
|
usage,
|
|
583
|
-
|
|
591
|
+
hocImportSource: toRelativeImportSource(id, target.file),
|
|
584
592
|
hocExportedName: target.info.exportedName
|
|
585
593
|
};
|
|
586
594
|
}))).filter((usage) => usage !== null);
|
package/build/plugin/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_factory = require("./factory-
|
|
5
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
6
6
|
//#region src/plugin/index.ts
|
|
7
7
|
const DataSourceLazyPlugin = /* @__PURE__ */ (0, require("unplugin").createUnplugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
8
8
|
//#endregion
|
package/build/plugin/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory, t as DEFAULT_HOCS } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory, t as DEFAULT_HOCS } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/index.ts
|
|
4
4
|
const DataSourceLazyPlugin = /* @__PURE__ */ createUnplugin(dataSourceLazyUnpluginFactory);
|
package/build/plugin/rollup.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_factory = require("./factory-
|
|
1
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
2
2
|
//#region src/plugin/rollup.ts
|
|
3
3
|
var rollup_default = (0, require("unplugin").createRollupPlugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
4
4
|
//#endregion
|
package/build/plugin/rollup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createRollupPlugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/rollup.ts
|
|
4
4
|
var rollup_default = createRollupPlugin(dataSourceLazyUnpluginFactory);
|
package/build/plugin/rspack.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_factory = require("./factory-
|
|
1
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
2
2
|
//#region src/plugin/rspack.ts
|
|
3
3
|
var rspack_default = (0, require("unplugin").createRspackPlugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
4
4
|
//#endregion
|
package/build/plugin/rspack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createRspackPlugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/rspack.ts
|
|
4
4
|
var rspack_default = createRspackPlugin(dataSourceLazyUnpluginFactory);
|
package/build/plugin/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_factory = require("./factory-
|
|
1
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
2
2
|
//#region src/plugin/vite.ts
|
|
3
3
|
var vite_default = (0, require("unplugin").createVitePlugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
4
4
|
//#endregion
|
package/build/plugin/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createVitePlugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/vite.ts
|
|
4
4
|
var vite_default = createVitePlugin(dataSourceLazyUnpluginFactory);
|
package/build/plugin/webpack.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_factory = require("./factory-
|
|
1
|
+
const require_factory = require("./factory-Dq6kUGl-.cjs");
|
|
2
2
|
//#region src/plugin/webpack.ts
|
|
3
3
|
var webpack_default = (0, require("unplugin").createWebpackPlugin)(require_factory.dataSourceLazyUnpluginFactory);
|
|
4
4
|
//#endregion
|
package/build/plugin/webpack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dataSourceLazyUnpluginFactory } from "./factory-
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-Ds3_-8kv.mjs";
|
|
2
2
|
import { createWebpackPlugin } from "unplugin";
|
|
3
3
|
//#region src/plugin/webpack.ts
|
|
4
4
|
var webpack_default = createWebpackPlugin(dataSourceLazyUnpluginFactory);
|