@powerlines/plugin-unimport 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var types$1=require('@storm-software/config-tools/types'),throttle=require('@stryke/helpers/throttle'),stormJson=require('@stryke/json/storm-json'),join=require('@stryke/path/join'),f=require('defu'),unimport=require('unimport'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var f__default=/*#__PURE__*/_interopDefault(f);/*****************************************
2
+ *
3
+ * ⚡ Built by Storm Software
4
+ *
5
+ *****************************************/
6
+
7
+ var g=Object.defineProperty;var e=(r,t)=>g(r,"name",{value:t,configurable:true});const d=e(r=>({name:"unimport",config(){return {unimport:f__default.default(r,{commentsDisable:["@unimport-disable","@unimport-ignore","@imports-disable","@imports-ignore","@powerlines-disable","@powerlines-ignore"],commentsDebug:["@unimport-debug","@imports-debug","@powerlines-debug"],injectAtEnd:true})}},async configResolved(){const{injectImports:t,init:i,...o}=unimport.createUnimport(this.config.unimport);this.unimport={...o},this.unimport.dumpImports=throttle.throttle(async()=>{this.log(types$1.LogLevelLabel.TRACE,"Dumping import file...");const s=await this.unimport.getImports();this.log(types$1.LogLevelLabel.TRACE,`Writing imports-dump JSON file: ${join.joinPaths(this.dataPath,"imports-dump.json")}`);const n=stormJson.StormJSON.stringify(s);n.trim()!==this.unimport.lastImportsDump?.trim()&&(this.unimport.lastImportsDump=n,await this.fs.writeFile(join.joinPaths(this.dataPath,"imports-dump.json"),n,{mode:"fs"}));},1e3),this.unimport.injectImports=async(s,n,a)=>{const m=await t(s,n,a);return m.s.hasChanged()&&await this.unimport.dumpImports(),m},this.unimport.init=async()=>{await i(),await this.unimport.dumpImports();},await this.unimport.init();},async transform(t,i){const o=await this.unimport.injectImports(t,i);return o.s.hasChanged()?{id:i,code:o.s.toString(),map:o.s.generateMap({source:i,includeContent:true,hires:true})}:null}}),"plugin");var J=d;exports.default=J;exports.plugin=d;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
@@ -0,0 +1,33 @@
1
+ import { U as UnimportPluginContext, a as UnimportPluginOptions, P as Plugin } from '../index-BsblZcdH.cjs';
2
+ export { b as UnimportContext, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.cjs';
3
+ import '@storm-software/build-tools/types';
4
+ import '@storm-software/config-tools/types';
5
+ import '@storm-software/config/types';
6
+ import '@stryke/types/base';
7
+ import '@stryke/types/configuration';
8
+ import '@stryke/types/file';
9
+ import 'vite';
10
+ import '@stryke/env/get-env-paths';
11
+ import '@stryke/types/package-json';
12
+ import 'jiti';
13
+ import 'oxc-parser';
14
+ import 'semver';
15
+ import 'unplugin';
16
+ import '@stryke/types/tsconfig';
17
+ import 'typescript';
18
+ import '@stryke/json/types';
19
+ import 'memfs';
20
+ import 'node:fs';
21
+ import 'unionfs';
22
+ import '@stryke/types/array';
23
+ import 'unimport';
24
+
25
+ /**
26
+ * A Powerlines plugin to integrate Unimport for code generation.
27
+ *
28
+ * @param options - The plugin options.
29
+ * @returns A Powerlines plugin instance.
30
+ */
31
+ declare const plugin: <TContext extends UnimportPluginContext = UnimportPluginContext>(options: UnimportPluginOptions) => Plugin<TContext>;
32
+
33
+ export { UnimportPluginContext, UnimportPluginOptions, plugin as default, plugin };
@@ -0,0 +1,33 @@
1
+ import { U as UnimportPluginContext, a as UnimportPluginOptions, P as Plugin } from '../index-BsblZcdH.js';
2
+ export { b as UnimportContext, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.js';
3
+ import '@storm-software/build-tools/types';
4
+ import '@storm-software/config-tools/types';
5
+ import '@storm-software/config/types';
6
+ import '@stryke/types/base';
7
+ import '@stryke/types/configuration';
8
+ import '@stryke/types/file';
9
+ import 'vite';
10
+ import '@stryke/env/get-env-paths';
11
+ import '@stryke/types/package-json';
12
+ import 'jiti';
13
+ import 'oxc-parser';
14
+ import 'semver';
15
+ import 'unplugin';
16
+ import '@stryke/types/tsconfig';
17
+ import 'typescript';
18
+ import '@stryke/json/types';
19
+ import 'memfs';
20
+ import 'node:fs';
21
+ import 'unionfs';
22
+ import '@stryke/types/array';
23
+ import 'unimport';
24
+
25
+ /**
26
+ * A Powerlines plugin to integrate Unimport for code generation.
27
+ *
28
+ * @param options - The plugin options.
29
+ * @returns A Powerlines plugin instance.
30
+ */
31
+ declare const plugin: <TContext extends UnimportPluginContext = UnimportPluginContext>(options: UnimportPluginOptions) => Plugin<TContext>;
32
+
33
+ export { UnimportPluginContext, UnimportPluginOptions, plugin as default, plugin };
@@ -0,0 +1,7 @@
1
+ import {LogLevelLabel}from'@storm-software/config-tools/types';import {throttle}from'@stryke/helpers/throttle';import {StormJSON}from'@stryke/json/storm-json';import {joinPaths}from'@stryke/path/join';import f from'defu';import {createUnimport}from'unimport';export*from'./types';/*****************************************
2
+ *
3
+ * ⚡ Built by Storm Software
4
+ *
5
+ *****************************************/
6
+
7
+ var g=Object.defineProperty;var e=(r,t)=>g(r,"name",{value:t,configurable:true});const d=e(r=>({name:"unimport",config(){return {unimport:f(r,{commentsDisable:["@unimport-disable","@unimport-ignore","@imports-disable","@imports-ignore","@powerlines-disable","@powerlines-ignore"],commentsDebug:["@unimport-debug","@imports-debug","@powerlines-debug"],injectAtEnd:true})}},async configResolved(){const{injectImports:t,init:i,...o}=createUnimport(this.config.unimport);this.unimport={...o},this.unimport.dumpImports=throttle(async()=>{this.log(LogLevelLabel.TRACE,"Dumping import file...");const s=await this.unimport.getImports();this.log(LogLevelLabel.TRACE,`Writing imports-dump JSON file: ${joinPaths(this.dataPath,"imports-dump.json")}`);const n=StormJSON.stringify(s);n.trim()!==this.unimport.lastImportsDump?.trim()&&(this.unimport.lastImportsDump=n,await this.fs.writeFile(joinPaths(this.dataPath,"imports-dump.json"),n,{mode:"fs"}));},1e3),this.unimport.injectImports=async(s,n,a)=>{const m=await t(s,n,a);return m.s.hasChanged()&&await this.unimport.dumpImports(),m},this.unimport.init=async()=>{await i(),await this.unimport.dumpImports();},await this.unimport.init();},async transform(t,i){const o=await this.unimport.injectImports(t,i);return o.s.hasChanged()?{id:i,code:o.s.toString(),map:o.s.generateMap({source:i,includeContent:true,hires:true})}:null}}),"plugin");var N=d;export{N as default,d as plugin};
@@ -0,0 +1 @@
1
+ 'use strict';var plugin=require('./plugin');Object.keys(plugin).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return plugin[k]}})});
@@ -0,0 +1,22 @@
1
+ export { b as UnimportContext, U as UnimportPluginContext, a as UnimportPluginOptions, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.cjs';
2
+ import '@storm-software/build-tools/types';
3
+ import '@storm-software/config-tools/types';
4
+ import '@storm-software/config/types';
5
+ import '@stryke/types/base';
6
+ import '@stryke/types/configuration';
7
+ import '@stryke/types/file';
8
+ import 'vite';
9
+ import '@stryke/env/get-env-paths';
10
+ import '@stryke/types/package-json';
11
+ import 'jiti';
12
+ import 'oxc-parser';
13
+ import 'semver';
14
+ import 'unplugin';
15
+ import '@stryke/types/tsconfig';
16
+ import 'typescript';
17
+ import '@stryke/json/types';
18
+ import 'memfs';
19
+ import 'node:fs';
20
+ import 'unionfs';
21
+ import '@stryke/types/array';
22
+ import 'unimport';
@@ -0,0 +1,22 @@
1
+ export { b as UnimportContext, U as UnimportPluginContext, a as UnimportPluginOptions, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.js';
2
+ import '@storm-software/build-tools/types';
3
+ import '@storm-software/config-tools/types';
4
+ import '@storm-software/config/types';
5
+ import '@stryke/types/base';
6
+ import '@stryke/types/configuration';
7
+ import '@stryke/types/file';
8
+ import 'vite';
9
+ import '@stryke/env/get-env-paths';
10
+ import '@stryke/types/package-json';
11
+ import 'jiti';
12
+ import 'oxc-parser';
13
+ import 'semver';
14
+ import 'unplugin';
15
+ import '@stryke/types/tsconfig';
16
+ import 'typescript';
17
+ import '@stryke/json/types';
18
+ import 'memfs';
19
+ import 'node:fs';
20
+ import 'unionfs';
21
+ import '@stryke/types/array';
22
+ import 'unimport';
@@ -0,0 +1 @@
1
+ export*from'./plugin';
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,22 @@
1
+ export { b as UnimportContext, U as UnimportPluginContext, a as UnimportPluginOptions, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.cjs';
2
+ import 'unimport';
3
+ import '@storm-software/build-tools/types';
4
+ import '@storm-software/config-tools/types';
5
+ import '@storm-software/config/types';
6
+ import '@stryke/types/base';
7
+ import '@stryke/types/configuration';
8
+ import '@stryke/types/file';
9
+ import 'vite';
10
+ import '@stryke/env/get-env-paths';
11
+ import '@stryke/types/package-json';
12
+ import 'jiti';
13
+ import 'oxc-parser';
14
+ import 'semver';
15
+ import 'unplugin';
16
+ import '@stryke/types/tsconfig';
17
+ import 'typescript';
18
+ import '@stryke/json/types';
19
+ import 'memfs';
20
+ import 'node:fs';
21
+ import 'unionfs';
22
+ import '@stryke/types/array';
@@ -0,0 +1,22 @@
1
+ export { b as UnimportContext, U as UnimportPluginContext, a as UnimportPluginOptions, d as UnimportPluginResolvedConfig, c as UnimportPluginUserConfig } from '../index-BsblZcdH.js';
2
+ import 'unimport';
3
+ import '@storm-software/build-tools/types';
4
+ import '@storm-software/config-tools/types';
5
+ import '@storm-software/config/types';
6
+ import '@stryke/types/base';
7
+ import '@stryke/types/configuration';
8
+ import '@stryke/types/file';
9
+ import 'vite';
10
+ import '@stryke/env/get-env-paths';
11
+ import '@stryke/types/package-json';
12
+ import 'jiti';
13
+ import 'oxc-parser';
14
+ import 'semver';
15
+ import 'unplugin';
16
+ import '@stryke/types/tsconfig';
17
+ import 'typescript';
18
+ import '@stryke/json/types';
19
+ import 'memfs';
20
+ import 'node:fs';
21
+ import 'unionfs';
22
+ import '@stryke/types/array';
File without changes
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@powerlines/plugin-unimport",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "A Powerlines plugin to add imports to source code automatically via unimport.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/powerlines.git",
9
+ "directory": "packages/plugin-unimport"
10
+ },
11
+ "homepage": "https://stormsoftware.com",
12
+ "bugs": {
13
+ "url": "https://stormsoftware.com/support",
14
+ "email": "support@stormsoftware.com"
15
+ },
16
+ "author": {
17
+ "name": "Storm Software",
18
+ "email": "contact@stormsoftware.com",
19
+ "url": "https://stormsoftware.com"
20
+ },
21
+ "maintainers": [
22
+ {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ }
27
+ ],
28
+ "contributors": [
29
+ {
30
+ "name": "Storm Software",
31
+ "email": "contact@stormsoftware.com",
32
+ "url": "https://stormsoftware.com"
33
+ }
34
+ ],
35
+ "funding": {
36
+ "type": "github",
37
+ "url": "https://github.com/sponsors/storm-software"
38
+ },
39
+ "license": "Apache-2.0",
40
+ "private": false,
41
+ "main": "dist/index.cjs",
42
+ "module": "dist/index.js",
43
+ "exports": {
44
+ "./package.json": "./package.json",
45
+ ".": {
46
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
47
+ "require": {
48
+ "types": "./dist/index.d.cts",
49
+ "default": "./dist/index.cjs"
50
+ },
51
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
52
+ },
53
+ "./index": {
54
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
55
+ "require": {
56
+ "types": "./dist/index.d.cts",
57
+ "default": "./dist/index.cjs"
58
+ },
59
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
60
+ },
61
+ "./plugin": {
62
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
63
+ "require": {
64
+ "types": "./dist/index.d.cts",
65
+ "default": "./dist/index.cjs"
66
+ },
67
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
68
+ },
69
+ "./types": {
70
+ "import": {
71
+ "types": "./dist/types/index.d.ts",
72
+ "default": "./dist/types/index.js"
73
+ },
74
+ "require": {
75
+ "types": "./dist/types/index.d.cts",
76
+ "default": "./dist/types/index.cjs"
77
+ },
78
+ "default": {
79
+ "types": "./dist/types/index.d.ts",
80
+ "default": "./dist/types/index.js"
81
+ }
82
+ },
83
+ "./types/*": {
84
+ "import": {
85
+ "types": "./dist/types/*.d.ts",
86
+ "default": "./dist/types/*.js"
87
+ },
88
+ "require": {
89
+ "types": "./dist/types/*.d.cts",
90
+ "default": "./dist/types/*.cjs"
91
+ },
92
+ "default": {
93
+ "types": "./dist/types/*.d.ts",
94
+ "default": "./dist/types/*.js"
95
+ }
96
+ }
97
+ },
98
+ "typings": "dist/index.d.ts",
99
+ "files": ["dist/**/*"],
100
+ "keywords": ["unimport", "powerlines", "storm-software", "powerlines-plugin"],
101
+ "dependencies": {
102
+ "@stryke/path": "^0.18.5",
103
+ "@stryke/helpers": "^0.9.2",
104
+ "@stryke/fs": "^0.32.10",
105
+ "@stryke/json": "^0.9.3",
106
+ "@stryke/type-checks": "^0.3.10",
107
+ "@stryke/types": "^0.10.0",
108
+ "defu": "^6.1.4",
109
+ "jiti": "^2.6.1",
110
+ "unimport": "^5.5.0",
111
+ "powerlines": "^0.15.0",
112
+ "magic-string": "^0.30.21"
113
+ },
114
+ "devDependencies": {
115
+ "@powerlines/nx": "^0.10.0",
116
+ "@powerlines/plugin-plugin": "^0.11.8",
117
+ "@types/node": "^22.19.0"
118
+ },
119
+ "publishConfig": { "access": "public" },
120
+ "gitHead": "b64f9a9d53b6eb8054c361da347f6623a7ba9e45"
121
+ }