@kirana-style/parcel-transformer 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +18 -2
- package/package.json +51 -4
- package/src/index.d.ts +29 -0
- package/src/index.js +46 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0](https://github.com/kirana-style/kirana/compare/v0.1.0...v0.2.0) (2026-10-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* one command name, kirana-style ([#29](https://github.com/kirana-style/kirana/issues/29))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **editor:** real editor output on the site, open vsx trusted publishing ([#21](https://github.com/kirana-style/kirana/issues/21)) ([350fa4e](https://github.com/kirana-style/kirana/commit/350fa4ec0d8054a082d6c7dcdae2b5be53f8d98a))
|
|
13
|
+
* one command name, kirana-style ([#29](https://github.com/kirana-style/kirana/issues/29)) ([b3f3154](https://github.com/kirana-style/kirana/commit/b3f3154662589dd1bd43fd0ff2341acf4f3df628))
|
|
14
|
+
* **site:** paper, ink, scenery and type for one identity ([#27](https://github.com/kirana-style/kirana/issues/27)) ([5da3c6f](https://github.com/kirana-style/kirana/commit/5da3c6f0f1c8cbfdb450b36a6609a3ab4b20e358))
|
|
15
|
+
* **site:** reorganise the homepage, product pages and docs ([#28](https://github.com/kirana-style/kirana/issues/28)) ([88b5209](https://github.com/kirana-style/kirana/commit/88b52093488b2aa0112b458ca04b836c83d03954))
|
|
16
|
+
* **site:** scenery gradients, logo downloads, pixel k, glass icons ([#25](https://github.com/kirana-style/kirana/issues/25)) ([2953dc1](https://github.com/kirana-style/kirana/commit/2953dc126f47b68257ebfdb33c61992984708c49))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug fixes
|
|
20
|
+
|
|
21
|
+
* hold emnapi at 2.0.0-alpha.6, the wasi engine fails on the beta ([#26](https://github.com/kirana-style/kirana/issues/26)) ([8aa33e1](https://github.com/kirana-style/kirana/commit/8aa33e1dbccaefa15b87f6487ac0a346bbf6581a))
|
|
22
|
+
* settle the ember dev check, resolve code scanning findings ([#23](https://github.com/kirana-style/kirana/issues/23)) ([0c266c8](https://github.com/kirana-style/kirana/commit/0c266c8428c1453892beeeb5f98918cbc0eae6ff))
|
|
23
|
+
* **site:** keep syntax colours in the production build ([#22](https://github.com/kirana-style/kirana/issues/22)) ([621f2fc](https://github.com/kirana-style/kirana/commit/621f2fcf67dada773ca66110e295ab7ac5605f56))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
* fix the extension's settings table ([#13](https://github.com/kirana-style/kirana/issues/13)) ([457e06d](https://github.com/kirana-style/kirana/commit/457e06d12f9e3b005e0820aab36faac5bf3f80b3))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
* bump the minor-and-patch group across 1 directory with 3 updates ([#19](https://github.com/kirana-style/kirana/issues/19)) ([7ea00ed](https://github.com/kirana-style/kirana/commit/7ea00edcc5cc02b9ab5e41b13f152ae344ea448f))
|
|
34
|
+
* emnapi 2.0.0-beta.1, minor and patch updates ([#24](https://github.com/kirana-style/kirana/issues/24)) ([a399fa7](https://github.com/kirana-style/kirana/commit/a399fa78e53dcfd7f41f249ccee1133809e66544))
|
|
35
|
+
|
|
36
|
+
## [0.1.0](https://github.com/kirana-style/kirana/compare/v0.1.0...v0.1.0) (2026-10-13)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* kirana goes public — write objects, read classes, ship css ([79732ed](https://github.com/kirana-style/kirana/commit/79732edd5cab419169ab74ad59e1c70053dfa57d))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Dependencies
|
|
45
|
+
|
|
46
|
+
* bump the minor-and-patch group in /packages/kirana with 6 updates ([#10](https://github.com/kirana-style/kirana/issues/10)) ([0deaf9f](https://github.com/kirana-style/kirana/commit/0deaf9f3e75ebc377d764c294250bd2577d53844))
|
|
47
|
+
* bump the oxc group in /packages/kirana with 7 updates ([#9](https://github.com/kirana-style/kirana/issues/9)) ([a3ca94c](https://github.com/kirana-style/kirana/commit/a3ca94c170b2ca49c9691abf5ad48c3ef4ac8620))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kirana authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kirana-style/parcel-transformer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Kirana for Parcel (D-070): a transformer that compiles styles in scripts. The stylesheet comes from
|
|
4
|
+
`@kirana-style/postcss`, where a stylesheet says `@kirana;`.
|
|
5
|
+
|
|
6
|
+
```json
|
|
7
|
+
// .parcelrc
|
|
8
|
+
{
|
|
9
|
+
"extends": "@parcel/config-default",
|
|
10
|
+
"transformers": {
|
|
11
|
+
"*.{js,mjs,jsx,ts,tsx}": ["@kirana-style/parcel-transformer", "..."]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
// .postcssrc
|
|
18
|
+
{ "plugins": { "@kirana-style/postcss": {} } }
|
|
19
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirana-style/parcel-transformer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Kirana for Parcel: a transformer that compiles styles in scripts, with the stylesheet from @kirana-style/postcss.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "The Kirana authors",
|
|
7
|
+
"homepage": "https://kirana.style",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kirana-style/kirana.git",
|
|
11
|
+
"directory": "packages/kirana/npm/parcel-transformer"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/kirana-style/kirana/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./src/index.d.ts",
|
|
23
|
+
"default": "./src/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@kirana-style/compiler": "0.2.0",
|
|
29
|
+
"@kirana-style/core": "0.2.0",
|
|
30
|
+
"@kirana-style/postcss": "0.2.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@parcel/plugin": "^2.16.0"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"parcel": "^2.16.0"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"src",
|
|
40
|
+
"bin",
|
|
41
|
+
"*.d.ts",
|
|
42
|
+
"*.css",
|
|
43
|
+
"README.md",
|
|
44
|
+
"CHANGELOG.md",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"builders.json",
|
|
47
|
+
"schemas",
|
|
48
|
+
"gatsby-node.mjs",
|
|
49
|
+
"rules",
|
|
50
|
+
"recommended.json",
|
|
51
|
+
"strict.json"
|
|
52
|
+
]
|
|
53
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Driver } from "@kirana-style/compiler";
|
|
2
|
+
import { Transformer } from "@parcel/plugin";
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
/** The part of Parcel's mutable asset the transformer uses. */
|
|
5
|
+
export type Asset = {
|
|
6
|
+
filePath: string;
|
|
7
|
+
getCode: () => Promise<string>;
|
|
8
|
+
setCode: (code: string) => void;
|
|
9
|
+
invalidateOnFileChange: (file: string) => void;
|
|
10
|
+
};
|
|
11
|
+
/** The part of Parcel's plugin logger the transformer uses. */
|
|
12
|
+
export type Logger = {
|
|
13
|
+
warn: (diagnostic: {
|
|
14
|
+
message: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
/** The session for a project root, opened once per worker. */
|
|
18
|
+
export declare function driverFor(root: string): Promise<Driver>;
|
|
19
|
+
/** Compiles one script asset in place; errors fail the build, warnings go to Parcel's logger. */
|
|
20
|
+
export declare function transform({ asset, options, logger }: {
|
|
21
|
+
asset: Asset;
|
|
22
|
+
options: {
|
|
23
|
+
projectRoot: string;
|
|
24
|
+
};
|
|
25
|
+
logger: Logger;
|
|
26
|
+
}): Promise<Asset[]>;
|
|
27
|
+
declare const _default: Transformer<unknown>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { _default as default };
|
package/src/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Driver } from "@kirana-style/compiler";
|
|
2
|
+
import { createReporter, shouldCompile } from "@kirana-style/compiler/host";
|
|
3
|
+
import { Transformer } from "@parcel/plugin";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Kirana for Parcel (D-070). Parcel runs transformers in worker processes and offers no step that
|
|
7
|
+
* sees every module, so the work is split as it is for Turbopack (D-065): this transformer rewrites
|
|
8
|
+
* styles in each script into class names, and `@kirana-style/postcss` compiles the whole project where the
|
|
9
|
+
* stylesheet says `@kirana;`. The two sessions agree because a class name is a hash of what it
|
|
10
|
+
* styles (D-037).
|
|
11
|
+
*
|
|
12
|
+
* .parcelrc { "extends": "@parcel/config-default",
|
|
13
|
+
* "transformers": { "*.{js,mjs,jsx,ts,tsx}": ["@kirana-style/parcel-transformer", "..."] } }
|
|
14
|
+
* .postcssrc { "plugins": { "@kirana-style/postcss": {} } }
|
|
15
|
+
*/
|
|
16
|
+
const drivers = /* @__PURE__ */ new Map();
|
|
17
|
+
/** The session for a project root, opened once per worker. */
|
|
18
|
+
function driverFor(root) {
|
|
19
|
+
let driver = drivers.get(root);
|
|
20
|
+
if (!driver) {
|
|
21
|
+
driver = Driver.create({ root });
|
|
22
|
+
drivers.set(root, driver);
|
|
23
|
+
}
|
|
24
|
+
return driver;
|
|
25
|
+
}
|
|
26
|
+
const reporter = createReporter();
|
|
27
|
+
/** Compiles one script asset in place; errors fail the build, warnings go to Parcel's logger. */
|
|
28
|
+
async function transform({ asset, options, logger }) {
|
|
29
|
+
const driver = await driverFor(options.projectRoot);
|
|
30
|
+
if (driver.configFile) asset.invalidateOnFileChange(driver.configFile);
|
|
31
|
+
const source = await asset.getCode();
|
|
32
|
+
if (!shouldCompile(asset.filePath, source, driver.libraries)) return [asset];
|
|
33
|
+
const result = driver.transform(asset.filePath, source);
|
|
34
|
+
for (const dependency of result.dependencies) asset.invalidateOnFileChange(dependency);
|
|
35
|
+
reporter.module({
|
|
36
|
+
warn: (message) => logger.warn({ message }),
|
|
37
|
+
error: (message) => {
|
|
38
|
+
throw new Error(message);
|
|
39
|
+
}
|
|
40
|
+
}, asset.filePath, source, result.diagnostics);
|
|
41
|
+
if (result.code !== void 0) asset.setCode(result.code);
|
|
42
|
+
return [asset];
|
|
43
|
+
}
|
|
44
|
+
var src_default = new Transformer({ transform });
|
|
45
|
+
//#endregion
|
|
46
|
+
export { src_default as default, driverFor, transform };
|