@jay-framework/rollup-plugin 0.16.1 → 0.16.2

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -0
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -37,6 +37,15 @@ async function writeGeneratedFile(jayContext, context, id, code) {
37
37
  if (relativePath.startsWith("build" + path.sep)) {
38
38
  relativePath = relativePath.slice(("build" + path.sep).length);
39
39
  }
40
+ if (relativePath.startsWith("..")) {
41
+ const idDir = path.dirname(id);
42
+ const pagesIdx = idDir.lastIndexOf(path.sep + "pages" + path.sep);
43
+ if (pagesIdx !== -1) {
44
+ relativePath = idDir.slice(pagesIdx + 1);
45
+ } else {
46
+ relativePath = path.basename(idDir);
47
+ }
48
+ }
40
49
  const filePath = path.resolve(jayContext.outputDir, relativePath, path.basename(id));
41
50
  await mkdir(path.dirname(filePath), { recursive: true });
42
51
  await writeFile(filePath, code, { encoding: "utf8", flag: "w" });
@@ -89,6 +98,10 @@ function jayDefinitions(projectRoot) {
89
98
  return null;
90
99
  },
91
100
  async transform(code, id) {
101
+ const resolvedId = fs.realpathSync(id);
102
+ if (!resolvedId.startsWith(projectRoot)) {
103
+ return null;
104
+ }
92
105
  if (hasExtension(id, JAY_EXTENSION)) {
93
106
  const context = this;
94
107
  const { filename, dirname } = getFileContext(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/rollup-plugin",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -27,17 +27,17 @@
27
27
  "test:watch": "vitest"
28
28
  },
29
29
  "dependencies": {
30
- "@jay-framework/compiler": "^0.16.1",
31
- "@jay-framework/compiler-jay-html": "^0.16.1",
32
- "@jay-framework/logger": "^0.16.1",
30
+ "@jay-framework/compiler": "^0.16.2",
31
+ "@jay-framework/compiler-jay-html": "^0.16.2",
32
+ "@jay-framework/logger": "^0.16.2",
33
33
  "fast-glob": "^3.3.2",
34
34
  "typescript": "^5.3.3"
35
35
  },
36
36
  "devDependencies": {
37
- "@jay-framework/component": "^0.16.1",
38
- "@jay-framework/dev-environment": "^0.16.1",
39
- "@jay-framework/runtime": "^0.16.1",
40
- "@jay-framework/secure": "^0.16.1",
37
+ "@jay-framework/component": "^0.16.2",
38
+ "@jay-framework/dev-environment": "^0.16.2",
39
+ "@jay-framework/runtime": "^0.16.2",
40
+ "@jay-framework/secure": "^0.16.2",
41
41
  "@types/node": "^20.11.5",
42
42
  "rimraf": "^5.0.5",
43
43
  "rollup": "^4.9.5",